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_deleteScheduledMessage(options = {})  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Deletes a pending scheduled message from the queue. 
- 
  
    
      #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_scheduleMessage(options = {})  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Schedules a message to be sent 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)
| 19 20 21 22 23 24 25 | # File 'lib/slack/web/api/endpoints/chat.rb', line 19 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: conversations_id()['channel']['id']) if [:channel] logger.warn('The chat.command method is undocumented.') post('chat.command', ) end | 
#chat_delete(options = {}) ⇒ Object
Deletes a message.
| 38 39 40 41 42 43 | # File 'lib/slack/web/api/endpoints/chat.rb', line 38 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: conversations_id()['channel']['id']) if [:channel] post('chat.delete', ) end | 
#chat_deleteScheduledMessage(options = {}) ⇒ Object
Deletes a pending scheduled message from the queue.
| 56 57 58 59 60 61 | # File 'lib/slack/web/api/endpoints/chat.rb', line 56 def chat_deleteScheduledMessage( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :scheduled_message_id missing') if [:scheduled_message_id].nil? = .merge(channel: conversations_id()['channel']['id']) if [:channel] post('chat.deleteScheduledMessage', ) end | 
#chat_getPermalink(options = {}) ⇒ Object
Retrieve a permalink URL for a specific extant message
| 72 73 74 75 76 77 | # File 'lib/slack/web/api/endpoints/chat.rb', line 72 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: conversations_id()['channel']['id']) if [:channel] post('chat.getPermalink', ) end | 
#chat_meMessage(options = {}) ⇒ Object
Share a me message into a channel.
| 88 89 90 91 92 | # File 'lib/slack/web/api/endpoints/chat.rb', line 88 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.
| 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | # File 'lib/slack/web/api/endpoints/chat.rb', line 123 def chat_postEphemeral( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :text, :attachments or :blocks missing') if [:text].nil? && [:attachments].nil? && [:blocks].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 # blocks must be passed as an encoded JSON string if .key?(:blocks) blocks = [:blocks] blocks = JSON.dump(blocks) unless blocks.is_a?(String) = .merge(blocks: blocks) end post('chat.postEphemeral', ) end | 
#chat_postMessage(options = {}) ⇒ Object
Sends a message to a channel.
| 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | # File 'lib/slack/web/api/endpoints/chat.rb', line 178 def chat_postMessage( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :text, :attachments or :blocks missing') if [:text].nil? && [:attachments].nil? && [:blocks].nil? # attachments must be passed as an encoded JSON string if .key?(:attachments) = [:attachments] = JSON.dump() unless .is_a?(String) = .merge(attachments: ) end # blocks must be passed as an encoded JSON string if .key?(:blocks) blocks = [:blocks] blocks = JSON.dump(blocks) unless blocks.is_a?(String) = .merge(blocks: blocks) end post('chat.postMessage', ) end | 
#chat_scheduleMessage(options = {}) ⇒ Object
Schedules a message to be sent to a channel.
| 225 226 227 228 229 230 | # File 'lib/slack/web/api/endpoints/chat.rb', line 225 def chat_scheduleMessage( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :post_at missing') if [:post_at].nil? throw ArgumentError.new('Required arguments :text missing') if [:text].nil? post('chat.scheduleMessage', ) end | 
#chat_unfurl(options = {}) ⇒ Object
Provide custom unfurl behavior for user-posted URLs
| 249 250 251 252 253 254 255 | # File 'lib/slack/web/api/endpoints/chat.rb', line 249 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: conversations_id()['channel']['id']) if [:channel] post('chat.unfurl', ) end | 
#chat_update(options = {}) ⇒ Object
Updates a message.
| 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | # File 'lib/slack/web/api/endpoints/chat.rb', line 278 def chat_update( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :text, :attachments or :blocks missing') if [:text].nil? && [:attachments].nil? && [:blocks].nil? throw ArgumentError.new('Required arguments :ts missing') if [:ts].nil? = .merge(channel: conversations_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 # blocks must be passed as an encoded JSON string if .key?(:blocks) blocks = [:blocks] blocks = JSON.dump(blocks) unless blocks.is_a?(String) = .merge(blocks: blocks) end post('chat.update', ) end |