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_appendStream(options = {}) ⇒ Object
Appends text to an existing streaming conversation.
-
#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_startStream(options = {}) ⇒ Object
Starts a new streaming conversation.
-
#chat_stopStream(options = {}) ⇒ Object
Stops a streaming conversation.
-
#chat_unfurl(options = {}) ⇒ Object
Provide custom unfurl behavior for user-posted URLs.
-
#chat_update(options = {}) ⇒ Object
Updates a message.
Instance Method Details
#chat_appendStream(options = {}) ⇒ Object
Appends text to an existing streaming conversation.
22 23 24 25 26 27 28 |
# File 'lib/slack/web/api/endpoints/chat.rb', line 22 def chat_appendStream( = {}) raise ArgumentError, 'Required arguments :channel missing' if [:channel].nil? raise ArgumentError, 'Required arguments :ts missing' if [:ts].nil? raise ArgumentError, 'Required arguments :markdown_text missing' if [:markdown_text].nil? = .merge(channel: conversations_id()['channel']['id']) if [:channel] post('chat.appendStream', ) end |
#chat_command(options = {}) ⇒ Object
Execute a slash command in a public channel (undocumented)
40 41 42 43 44 45 46 |
# File 'lib/slack/web/api/endpoints/chat.rb', line 40 def chat_command( = {}) raise ArgumentError, 'Required arguments :channel missing' if [:channel].nil? raise ArgumentError, '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.
59 60 61 62 63 64 |
# File 'lib/slack/web/api/endpoints/chat.rb', line 59 def chat_delete( = {}) raise ArgumentError, 'Required arguments :channel missing' if [:channel].nil? raise ArgumentError, '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.
77 78 79 80 81 82 |
# File 'lib/slack/web/api/endpoints/chat.rb', line 77 def chat_deleteScheduledMessage( = {}) raise ArgumentError, 'Required arguments :channel missing' if [:channel].nil? raise ArgumentError, '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
93 94 95 96 97 98 |
# File 'lib/slack/web/api/endpoints/chat.rb', line 93 def chat_getPermalink( = {}) raise ArgumentError, 'Required arguments :channel missing' if [:channel].nil? raise ArgumentError, '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.
109 110 111 112 113 |
# File 'lib/slack/web/api/endpoints/chat.rb', line 109 def chat_meMessage( = {}) raise ArgumentError, 'Required arguments :channel missing' if [:channel].nil? raise ArgumentError, '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.
146 147 148 149 150 151 152 153 154 |
# File 'lib/slack/web/api/endpoints/chat.rb', line 146 def chat_postEphemeral( = {}) raise ArgumentError, 'Required arguments :channel missing' if [:channel].nil? raise ArgumentError, 'Required arguments :user missing' if [:user].nil? raise ArgumentError, 'At least one of :attachments, :blocks, :text, :markdown_text is required' if [:attachments].nil? && [:blocks].nil? && [:text].nil? && [:markdown_text].nil? raise ArgumentError, ':text, :markdown_text are mutually exclusive' if ![:text].nil? && ![:markdown_text].nil? = .merge(user: users_id()['user']['id']) if [:user] = (, %i[attachments blocks]) post('chat.postEphemeral', ) end |
#chat_postMessage(options = {}) ⇒ Object
Sends a message to a channel.
197 198 199 200 201 202 203 |
# File 'lib/slack/web/api/endpoints/chat.rb', line 197 def chat_postMessage( = {}) raise ArgumentError, 'Required arguments :channel missing' if [:channel].nil? raise ArgumentError, 'At least one of :attachments, :blocks, :text, :markdown_text is required' if [:attachments].nil? && [:blocks].nil? && [:text].nil? && [:markdown_text].nil? raise ArgumentError, ':text, :markdown_text are mutually exclusive' if ![:text].nil? && ![:markdown_text].nil? = (, %i[attachments blocks metadata]) post('chat.postMessage', ) end |
#chat_scheduleMessage(options = {}) ⇒ Object
Schedules a message to be sent to a channel.
238 239 240 241 242 243 244 245 |
# File 'lib/slack/web/api/endpoints/chat.rb', line 238 def chat_scheduleMessage( = {}) raise ArgumentError, 'Required arguments :channel missing' if [:channel].nil? raise ArgumentError, 'Required arguments :post_at missing' if [:post_at].nil? raise ArgumentError, 'At least one of :attachments, :blocks, :text, :markdown_text is required' if [:attachments].nil? && [:blocks].nil? && [:text].nil? && [:markdown_text].nil? raise ArgumentError, ':text, :markdown_text are mutually exclusive' if ![:text].nil? && ![:markdown_text].nil? = (, %i[attachments blocks metadata]) post('chat.scheduleMessage', ) end |
#chat_startStream(options = {}) ⇒ Object
Starts a new streaming conversation.
272 273 274 275 276 277 |
# File 'lib/slack/web/api/endpoints/chat.rb', line 272 def chat_startStream( = {}) raise ArgumentError, 'Required arguments :channel missing' if [:channel].nil? raise ArgumentError, 'Required arguments :thread_ts missing' if [:thread_ts].nil? = .merge(channel: conversations_id()['channel']['id']) if [:channel] post('chat.startStream', ) end |
#chat_stopStream(options = {}) ⇒ Object
Stops a streaming conversation.
296 297 298 299 300 301 302 |
# File 'lib/slack/web/api/endpoints/chat.rb', line 296 def chat_stopStream( = {}) raise ArgumentError, 'Required arguments :channel missing' if [:channel].nil? raise ArgumentError, 'Required arguments :ts missing' if [:ts].nil? = .merge(channel: conversations_id()['channel']['id']) if [:channel] = (, %i[metadata]) post('chat.stopStream', ) end |
#chat_unfurl(options = {}) ⇒ Object
Provide custom unfurl behavior for user-posted URLs
327 328 329 330 331 |
# File 'lib/slack/web/api/endpoints/chat.rb', line 327 def chat_unfurl( = {}) = .merge(channel: conversations_id()['channel']['id']) if [:channel] = (, %i[unfurls user_auth_blocks]) post('chat.unfurl', ) end |
#chat_update(options = {}) ⇒ Object
Updates a message.
364 365 366 367 368 369 370 371 372 |
# File 'lib/slack/web/api/endpoints/chat.rb', line 364 def chat_update( = {}) raise ArgumentError, 'Required arguments :channel missing' if [:channel].nil? raise ArgumentError, 'Required arguments :ts missing' if [:ts].nil? raise ArgumentError, 'At least one of :attachments, :blocks, :text, :markdown_text is required' if [:attachments].nil? && [:blocks].nil? && [:text].nil? && [:markdown_text].nil? raise ArgumentError, ':text, :markdown_text are mutually exclusive' if ![:text].nil? && ![:markdown_text].nil? = .merge(channel: conversations_id()['channel']['id']) if [:channel] = (, %i[attachments unfurled_attachments blocks metadata]) post('chat.update', ) end |