Module: Slack::Web::Api::Endpoints::Chat
- Included in:
- Slack::Web::Api::Endpoints
- Defined in:
- lib/slack/web/api/endpoints/chat.rb
Instance Method Summary collapse
-
#chat_command(options = {}) ⇒ Object
Execute a slash command in a public channel (undocumented).
-
#chat_delete(options = {}) ⇒ Object
Deletes a message.
-
#chat_getPermalink(options = {}) ⇒ Object
Retrieve a permalink URL for a specific extant message.
-
#chat_meMessage(options = {}) ⇒ Object
Share a me message into a channel.
-
#chat_postEphemeral(options = {}) ⇒ Object
Sends an ephemeral message to a user in a channel.
-
#chat_postMessage(options = {}) ⇒ Object
Sends a message to a channel.
-
#chat_unfurl(options = {}) ⇒ Object
Provide custom unfurl behavior for user-posted URLs.
-
#chat_update(options = {}) ⇒ Object
Updates a message.
Instance Method Details
#chat_command(options = {}) ⇒ Object
Execute a slash command in a public channel (undocumented)
18 19 20 21 22 23 24 |
# File 'lib/slack/web/api/endpoints/chat.rb', line 18 def chat_command( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :command missing') if [:command].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] logger.warn('The chat.command method is undocumented.') post('chat.command', ) end |
#chat_delete(options = {}) ⇒ Object
Deletes a message.
37 38 39 40 41 42 |
# File 'lib/slack/web/api/endpoints/chat.rb', line 37 def chat_delete( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :ts missing') if [:ts].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('chat.delete', ) end |
#chat_getPermalink(options = {}) ⇒ Object
Retrieve a permalink URL for a specific extant message
53 54 55 56 57 58 |
# File 'lib/slack/web/api/endpoints/chat.rb', line 53 def chat_getPermalink( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :message_ts missing') if [:message_ts].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('chat.getPermalink', ) end |
#chat_meMessage(options = {}) ⇒ Object
Share a me message into a channel.
69 70 71 72 73 |
# File 'lib/slack/web/api/endpoints/chat.rb', line 69 def chat_meMessage( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :text missing') if [:text].nil? post('chat.meMessage', ) end |
#chat_postEphemeral(options = {}) ⇒ Object
Sends an ephemeral message to a user in a channel.
94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/slack/web/api/endpoints/chat.rb', line 94 def chat_postEphemeral( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :text or :attachments missing') if [:text].nil? && [:attachments].nil? throw ArgumentError.new('Required arguments :user missing') if [:user].nil? = .merge(user: users_id()['user']['id']) if [:user] # attachments must be passed as an encoded JSON string if .key?(:attachments) = [:attachments] = JSON.dump() unless .is_a?(String) = .merge(attachments: ) end post('chat.postEphemeral', ) end |
#chat_postMessage(options = {}) ⇒ Object
Sends a message to a channel.
141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/slack/web/api/endpoints/chat.rb', line 141 def chat_postMessage( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :text or :attachments missing') if [:text].nil? && [:attachments].nil? # attachments must be passed as an encoded JSON string if .key?(:attachments) = [:attachments] = JSON.dump() unless .is_a?(String) = .merge(attachments: ) end post('chat.postMessage', ) end |
#chat_unfurl(options = {}) ⇒ Object
Provide custom unfurl behavior for user-posted URLs
170 171 172 173 174 175 176 |
# File 'lib/slack/web/api/endpoints/chat.rb', line 170 def chat_unfurl( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :ts missing') if [:ts].nil? throw ArgumentError.new('Required arguments :unfurls missing') if [:unfurls].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('chat.unfurl', ) end |
#chat_update(options = {}) ⇒ Object
Updates a message.
197 198 199 200 201 202 203 204 205 206 207 208 209 |
# File 'lib/slack/web/api/endpoints/chat.rb', line 197 def chat_update( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :text or :attachments missing') if [:text].nil? && [:attachments].nil? throw ArgumentError.new('Required arguments :ts missing') if [:ts].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] # attachments must be passed as an encoded JSON string if .key?(:attachments) = [:attachments] = JSON.dump() unless .is_a?(String) = .merge(attachments: ) end post('chat.update', ) end |