Class: SlackWebApi::ChatController

Inherits:
BaseController show all
Defined in:
lib/slack_web_api/controllers/chat_controller.rb

Overview

ChatController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

Methods inherited from BaseController

#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters

Constructor Details

This class inherits a constructor from SlackWebApi::BaseController

Instance Method Details

#chat_delete(token: nil, ts: nil, channel: nil, as_user: nil) ⇒ ApiResponse

Deletes a message. scope: chat:write deleted. to be deleted. delete the message as the authed user with chat:write:user scope. [Bot users](/bot-users) in this context are considered authed users. If unused or false, the message will be deleted with chat:write:bot scope.

Parameters:

  • token (String) (defaults to: nil)

    Optional parameter: Authentication token. Requires

  • ts (Float) (defaults to: nil)

    Optional parameter: Timestamp of the message to be

  • channel (String) (defaults to: nil)

    Optional parameter: Channel containing the message

  • as_user (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter: Pass true to

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/slack_web_api/controllers/chat_controller.rb', line 21

def chat_delete(token: nil,
                ts: nil,
                channel: nil,
                as_user: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/chat.delete',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token'))
               .form_param(new_parameter(ts, key: 'ts'))
               .form_param(new_parameter(channel, key: 'channel'))
               .form_param(new_parameter(as_user, key: 'as_user'))
               .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('slackAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ChatDeleteSuccessSchema.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             ChatDeleteErrorSchemaException))
    .execute
end

#chat_delete_scheduled_message(token, channel, scheduled_message_id, as_user: nil) ⇒ ApiResponse

Deletes a pending scheduled message from the queue. scope: chat:write scheduled_message is posting to scheduled_message_id returned from call to chat.scheduleMessage delete the message as the authed user with chat:write:user scope. [Bot users](/bot-users) in this context are considered authed users. If unused or false, the message will be deleted with chat:write:bot scope.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • channel (String)

    Required parameter: The channel the

  • scheduled_message_id (String)

    Required parameter:

  • as_user (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter: Pass true to

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/slack_web_api/controllers/chat_controller.rb', line 58

def chat_delete_scheduled_message(token,
                                  channel,
                                  scheduled_message_id,
                                  as_user: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/chat.deleteScheduledMessage',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .form_param(new_parameter(channel, key: 'channel')
                            .is_required(true))
               .form_param(new_parameter(scheduled_message_id, key: 'scheduled_message_id')
                            .is_required(true))
               .form_param(new_parameter(as_user, key: 'as_user'))
               .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('slackAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ChatDeleteScheduledMessageSchema.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response if no message is found',
                             ChatDeleteScheduledMessageErrorSchemaException))
    .execute
end

Retrieve a permalink URL for a specific extant message scope: none channel containing the message uniquely identifying it within a channel

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • channel (String)

    Required parameter: The ID of the conversation or

  • message_ts (String)

    Required parameter: A message’s ts value,

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/slack_web_api/controllers/chat_controller.rb', line 94

def chat_get_permalink(token,
                       channel,
                       message_ts)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/chat.getPermalink',
                                 Server::DEFAULT)
               .query_param(new_parameter(token, key: 'token')
                             .is_required(true))
               .query_param(new_parameter(channel, key: 'channel')
                             .is_required(true))
               .query_param(new_parameter(message_ts, key: 'message_ts')
                             .is_required(true))
               .header_param(new_parameter('application/x-www-form-urlencoded', key: 'Content-Type'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('slackAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ChatGetPermalinkSuccessSchema.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Error response when channel cannot be found',
                             ChatGetPermalinkErrorSchemaException))
    .execute
end

#chat_me_message(token: nil, channel: nil, text: nil) ⇒ ApiResponse

Share a me message into a channel. scope: chat:write Can be a public channel, private group or IM channel. Can be an encoded ID, or a name.

Parameters:

  • token (String) (defaults to: nil)

    Optional parameter: Authentication token. Requires

  • channel (String) (defaults to: nil)

    Optional parameter: Channel to send message to.

  • text (String) (defaults to: nil)

    Optional parameter: Text of the message to send.

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/slack_web_api/controllers/chat_controller.rb', line 128

def chat_me_message(token: nil,
                    channel: nil,
                    text: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/chat.meMessage',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token'))
               .form_param(new_parameter(channel, key: 'channel'))
               .form_param(new_parameter(text, key: 'text'))
               .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('slackAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ChatMeMessageSchema.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             ChatMeMessageErrorSchemaException))
    .execute
end

#chat_post_ephemeral(token, channel, user, as_user: nil, attachments: nil, blocks: nil, icon_emoji: nil, icon_url: nil, link_names: nil, parse: nil, text: nil, thread_ts: nil, username: nil) ⇒ ApiResponse

Sends an ephemeral message to a user in a channel. scope: chat:write channel to send message to. Can be an encoded ID, or a name. the ephemeral message. The user should be in the channel specified by the channel argument. post the message as the authed user. Defaults to true if the chat:write:bot scope is not included. Otherwise, defaults to false. structured attachments, presented as a URL-encoded string. structured blocks, presented as a URL-encoded string. for this message. Overrides icon_url. Must be used in conjunction with as_user set to false, otherwise ignored. See [authorship](#authorship) below. icon for this message. Must be used in conjunction with as_user set to false, otherwise ignored. See [authorship](#authorship) below. link channel names and usernames. Defaults to none. See [below](#formatting). it is required depends on other fields you use in your API call. [See below](#text_usage) for more detail. ts value to post this message in a thread. Avoid using a reply’s ts value; use its parent’s value instead. Ephemeral messages in threads are only shown if there is already an active thread. Must be used in conjunction with as_user set to false, otherwise ignored. See [authorship](#authorship) below.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • channel (String)

    Required parameter: Channel, private group, or IM

  • user (String)

    Required parameter: id of the user who will receive

  • as_user (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter: Pass true to

  • attachments (String) (defaults to: nil)

    Optional parameter: A JSON-based array of

  • blocks (String) (defaults to: nil)

    Optional parameter: A JSON-based array of

  • icon_emoji (String) (defaults to: nil)

    Optional parameter: Emoji to use as the icon

  • icon_url (String) (defaults to: nil)

    Optional parameter: URL to an image to use as the

  • link_names (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter: Find and

  • parse (String) (defaults to: nil)

    Optional parameter: Change how messages are treated.

  • text (String) (defaults to: nil)

    Optional parameter: How this field works and whether

  • thread_ts (String) (defaults to: nil)

    Optional parameter: Provide another message’s

  • username (String) (defaults to: nil)

    Optional parameter: Set your bot’s user name.

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/slack_web_api/controllers/chat_controller.rb', line 188

def chat_post_ephemeral(token,
                        channel,
                        user,
                        as_user: nil,
                        attachments: nil,
                        blocks: nil,
                        icon_emoji: nil,
                        icon_url: nil,
                        link_names: nil,
                        parse: nil,
                        text: nil,
                        thread_ts: nil,
                        username: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/chat.postEphemeral',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .form_param(new_parameter(channel, key: 'channel')
                            .is_required(true))
               .form_param(new_parameter(user, key: 'user')
                            .is_required(true))
               .form_param(new_parameter(as_user, key: 'as_user'))
               .form_param(new_parameter(attachments, key: 'attachments'))
               .form_param(new_parameter(blocks, key: 'blocks'))
               .form_param(new_parameter(icon_emoji, key: 'icon_emoji'))
               .form_param(new_parameter(icon_url, key: 'icon_url'))
               .form_param(new_parameter(link_names, key: 'link_names'))
               .form_param(new_parameter(parse, key: 'parse'))
               .form_param(new_parameter(text, key: 'text'))
               .form_param(new_parameter(thread_ts, key: 'thread_ts'))
               .form_param(new_parameter(username, key: 'username'))
               .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('slackAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ChatPostEphemeralSuccessSchema.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             ChatPostEphemeralErrorSchemaException))
    .execute
end

#chat_post_message(token, channel, as_user: nil, attachments: nil, blocks: nil, icon_emoji: nil, icon_url: nil, link_names: nil, mrkdwn: nil, parse: nil, reply_broadcast: nil, text: nil, thread_ts: nil, unfurl_links: nil, unfurl_media: nil, username: nil) ⇒ ApiResponse

Sends a message to a channel. scope: chat:write channel to send message to. Can be an encoded ID, or a name. See [below](#channels) for more details. as the authed user, instead of as a bot. Defaults to false. See [authorship](#authorship) below. structured attachments, presented as a URL-encoded string. structured blocks, presented as a URL-encoded string. for this message. Overrides icon_url. Must be used in conjunction with as_user set to false, otherwise ignored. See [authorship](#authorship) below. icon for this message. Must be used in conjunction with as_user set to false, otherwise ignored. See [authorship](#authorship) below. link channel names and usernames. markup parsing by setting to false. Enabled by default. Defaults to none. See [below](#formatting). in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false. it is required depends on other fields you use in your API call. [See below](#text_usage) for more detail. ts value to make this message a reply. Avoid using a reply’s ts value; use its parent instead. to enable unfurling of primarily text-based content. false to disable unfurling of media content. Must be used in conjunction with as_user set to false, otherwise ignored. See [authorship](#authorship) below.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • channel (String)

    Required parameter: Channel, private group, or IM

  • as_user (String) (defaults to: nil)

    Optional parameter: Pass true to post the message

  • attachments (String) (defaults to: nil)

    Optional parameter: A JSON-based array of

  • blocks (String) (defaults to: nil)

    Optional parameter: A JSON-based array of

  • icon_emoji (String) (defaults to: nil)

    Optional parameter: Emoji to use as the icon

  • icon_url (String) (defaults to: nil)

    Optional parameter: URL to an image to use as the

  • link_names (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter: Find and

  • mrkdwn (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter: Disable Slack

  • parse (String) (defaults to: nil)

    Optional parameter: Change how messages are treated.

  • reply_broadcast (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter: Used

  • text (String) (defaults to: nil)

    Optional parameter: How this field works and whether

  • thread_ts (String) (defaults to: nil)

    Optional parameter: Provide another message’s

  • unfurl_links (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter: Pass true

  • unfurl_media (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter: Pass

  • username (String) (defaults to: nil)

    Optional parameter: Set your bot’s user name.

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
# File 'lib/slack_web_api/controllers/chat_controller.rb', line 277

def chat_post_message(token,
                      channel,
                      as_user: nil,
                      attachments: nil,
                      blocks: nil,
                      icon_emoji: nil,
                      icon_url: nil,
                      link_names: nil,
                      mrkdwn: nil,
                      parse: nil,
                      reply_broadcast: nil,
                      text: nil,
                      thread_ts: nil,
                      unfurl_links: nil,
                      unfurl_media: nil,
                      username: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/chat.postMessage',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .form_param(new_parameter(channel, key: 'channel')
                            .is_required(true))
               .form_param(new_parameter(as_user, key: 'as_user'))
               .form_param(new_parameter(attachments, key: 'attachments'))
               .form_param(new_parameter(blocks, key: 'blocks'))
               .form_param(new_parameter(icon_emoji, key: 'icon_emoji'))
               .form_param(new_parameter(icon_url, key: 'icon_url'))
               .form_param(new_parameter(link_names, key: 'link_names'))
               .form_param(new_parameter(mrkdwn, key: 'mrkdwn'))
               .form_param(new_parameter(parse, key: 'parse'))
               .form_param(new_parameter(reply_broadcast, key: 'reply_broadcast'))
               .form_param(new_parameter(text, key: 'text'))
               .form_param(new_parameter(thread_ts, key: 'thread_ts'))
               .form_param(new_parameter(unfurl_links, key: 'unfurl_links'))
               .form_param(new_parameter(unfurl_media, key: 'unfurl_media'))
               .form_param(new_parameter(username, key: 'username'))
               .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('slackAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ChatPostMessageSuccessSchema.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response if too many attachments are included',
                             ChatPostMessageErrorSchemaException))
    .execute
end

#chat_schedule_message(token: nil, channel: nil, text: nil, post_at: nil, parse: nil, as_user: nil, link_names: nil, attachments: nil, blocks: nil, unfurl_links: nil, unfurl_media: nil, thread_ts: nil, reply_broadcast: nil) ⇒ ApiResponse

Schedules a message to be sent to a channel. scope: chat:write channel to send message to. Can be an encoded ID, or a name. See [below](#channels) for more details. it is required depends on other fields you use in your API call. [See below](#text_usage) for more detail. in future to send the message. Defaults to none. See [chat.postMessage](chat.postMessage#formatting). post the message as the authed user, instead of as a bot. Defaults to false. See [chat.postMessage](chat.postMessage#authorship). link channel names and usernames. structured attachments, presented as a URL-encoded string. structured blocks, presented as a URL-encoded string. to enable unfurling of primarily text-based content. false to disable unfurling of media content. ts value to make this message a reply. Avoid using a reply’s ts value; use its parent instead. in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false.

Parameters:

  • token (String) (defaults to: nil)

    Optional parameter: Authentication token. Requires

  • channel (String) (defaults to: nil)

    Optional parameter: Channel, private group, or DM

  • text (String) (defaults to: nil)

    Optional parameter: How this field works and whether

  • post_at (String) (defaults to: nil)

    Optional parameter: Unix EPOCH timestamp of time

  • parse (String) (defaults to: nil)

    Optional parameter: Change how messages are treated.

  • as_user (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter: Pass true to

  • link_names (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter: Find and

  • attachments (String) (defaults to: nil)

    Optional parameter: A JSON-based array of

  • blocks (String) (defaults to: nil)

    Optional parameter: A JSON-based array of

  • unfurl_links (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter: Pass true

  • unfurl_media (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter: Pass

  • thread_ts (Float) (defaults to: nil)

    Optional parameter: Provide another message’s

  • reply_broadcast (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter: Used

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
# File 'lib/slack_web_api/controllers/chat_controller.rb', line 361

def chat_schedule_message(token: nil,
                          channel: nil,
                          text: nil,
                          post_at: nil,
                          parse: nil,
                          as_user: nil,
                          link_names: nil,
                          attachments: nil,
                          blocks: nil,
                          unfurl_links: nil,
                          unfurl_media: nil,
                          thread_ts: nil,
                          reply_broadcast: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/chat.scheduleMessage',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token'))
               .form_param(new_parameter(channel, key: 'channel'))
               .form_param(new_parameter(text, key: 'text'))
               .form_param(new_parameter(post_at, key: 'post_at'))
               .form_param(new_parameter(parse, key: 'parse'))
               .form_param(new_parameter(as_user, key: 'as_user'))
               .form_param(new_parameter(link_names, key: 'link_names'))
               .form_param(new_parameter(attachments, key: 'attachments'))
               .form_param(new_parameter(blocks, key: 'blocks'))
               .form_param(new_parameter(unfurl_links, key: 'unfurl_links'))
               .form_param(new_parameter(unfurl_media, key: 'unfurl_media'))
               .form_param(new_parameter(thread_ts, key: 'thread_ts'))
               .form_param(new_parameter(reply_broadcast, key: 'reply_broadcast'))
               .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('slackAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ChatScheduleMessageSuccessSchema.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response if the `post_at` is invalid (ex. in the'\
                              ' past or too far into the future)',
                             ChatScheduleMessageErrorSchemaException))
    .execute
end

#chat_unfurl(token, channel, ts, unfurls: nil, user_auth_message: nil, user_auth_required: nil, user_auth_url: nil) ⇒ ApiResponse

Provide custom unfurl behavior for user-posted URLs scope: links:write unfurl behavior to. set to URLs featured in the the message, pointing to their unfurl blocks or message attachments. simply-formatted string to send as an ephemeral message to the user as invitation to authenticate further and enable full unfurling behavior to true or 1 to indicate the user must install your Slack app to trigger unfurls for this domain custom URL where they will complete authentication in your app to fully trigger unfurling. Value should be properly URL-encoded.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • channel (String)

    Required parameter: Channel ID of the message

  • ts (String)

    Required parameter: Timestamp of the message to add

  • unfurls (String) (defaults to: nil)

    Optional parameter: URL-encoded JSON map with keys

  • user_auth_message (String) (defaults to: nil)

    Optional parameter: Provide a

  • user_auth_required (TrueClass | FalseClass) (defaults to: nil)

    Optional parameter: Set

  • user_auth_url (String) (defaults to: nil)

    Optional parameter: Send users to this

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
# File 'lib/slack_web_api/controllers/chat_controller.rb', line 424

def chat_unfurl(token,
                channel,
                ts,
                unfurls: nil,
                user_auth_message: nil,
                user_auth_required: nil,
                user_auth_url: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/chat.unfurl',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .form_param(new_parameter(channel, key: 'channel')
                            .is_required(true))
               .form_param(new_parameter(ts, key: 'ts')
                            .is_required(true))
               .form_param(new_parameter(unfurls, key: 'unfurls'))
               .form_param(new_parameter(user_auth_message, key: 'user_auth_message'))
               .form_param(new_parameter(user_auth_required, key: 'user_auth_required'))
               .form_param(new_parameter(user_auth_url, key: 'user_auth_url'))
               .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('slackAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ChatUnfurlSuccessSchema.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             ChatUnfurlErrorSchemaException))
    .execute
end

#chat_update(token, channel, ts, as_user: nil, attachments: nil, blocks: nil, link_names: nil, parse: nil, text: nil) ⇒ ApiResponse

Updates a message. scope: chat:write to be updated. updated. message as the authed user. [Bot users](/bot-users) in this context are considered authed users. structured attachments, presented as a URL-encoded string. This field is required when not presenting text. If you don’t include this field, the message’s previous attachments will be retained. To remove previous attachments, include an empty array for this field. [structured blocks](/block-kit/building), presented as a URL-encoded string. If you don’t include this field, the message’s previous blocks will be retained. To remove previous blocks, include an empty array for this field. and usernames. Defaults to none. If you do not specify a value for this field, the original value set for the message will be overwritten with the default, none. Defaults to client, unlike chat.postMessage. Accepts either none or full. If you do not specify a value for this field, the original value set for the message will be overwritten with the default, client. the [default formatting rules](/reference/surfaces/formatting). It’s not required when presenting blocks or attachments.

Parameters:

  • token (String)

    Required parameter: Authentication token. Requires

  • channel (String)

    Required parameter: Channel containing the message

  • ts (String)

    Required parameter: Timestamp of the message to be

  • as_user (String) (defaults to: nil)

    Optional parameter: Pass true to update the

  • attachments (String) (defaults to: nil)

    Optional parameter: A JSON-based array of

  • blocks (String) (defaults to: nil)

    Optional parameter: A JSON-based array of

  • link_names (String) (defaults to: nil)

    Optional parameter: Find and link channel names

  • parse (String) (defaults to: nil)

    Optional parameter: Change how messages are treated.

  • text (String) (defaults to: nil)

    Optional parameter: New text for the message, using

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
# File 'lib/slack_web_api/controllers/chat_controller.rb', line 490

def chat_update(token,
                channel,
                ts,
                as_user: nil,
                attachments: nil,
                blocks: nil,
                link_names: nil,
                parse: nil,
                text: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/chat.update',
                                 Server::DEFAULT)
               .header_param(new_parameter(token, key: 'token')
                              .is_required(true))
               .form_param(new_parameter(channel, key: 'channel')
                            .is_required(true))
               .form_param(new_parameter(ts, key: 'ts')
                            .is_required(true))
               .form_param(new_parameter(as_user, key: 'as_user'))
               .form_param(new_parameter(attachments, key: 'attachments'))
               .form_param(new_parameter(blocks, key: 'blocks'))
               .form_param(new_parameter(link_names, key: 'link_names'))
               .form_param(new_parameter(parse, key: 'parse'))
               .form_param(new_parameter(text, key: 'text'))
               .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('slackAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ChatUpdateSuccessSchema.method(:from_hash))
                .is_api_response(true)
                .local_error('default',
                             'Typical error response',
                             ChatUpdateErrorSchemaException))
    .execute
end