Slack.Web.Chat (SlackKit v1.0.0-alpha.0)

View Source

Summary

Functions

Appends text to an existing streaming conversation.

Deletes a pending scheduled message from the queue.

Retrieve a permalink URL for a specific extant message

Share a me message into a channel.

Sends an ephemeral message to a user in a channel.

Sends a message to a channel.

Schedules a message to be sent to a channel.

Starts a new streaming conversation.

Stops a streaming conversation.

Provide custom unfurl behavior for user-posted URLs

Functions

append_stream(channel, markdown_text, ts, optional_params \\ %{})

Appends text to an existing streaming conversation.

API reference

Rate limit: Tier 4: 100+ per minute
Scopes:

View on docs.slack.dev ↗

Required Params

  • channel - An encoded ID that represents a channel, private group, or DM
  • markdown_text - Accepts message text formatted in markdown. Limit this field to 12,000 characters. This text is what will be appended to the message received so far. ex: **This is bold text**
  • ts - The timestamp of the streaming message.

Optional Params

  • chunks - Array of streaming chunks.

Errors the API can return:

  • invalid_metadata_format - Invalid metadata format provided
  • channel_type_not_supported - Channel type not supported
  • stopped_by_user - The streaming message was stopped by the user and no further appends are accepted.
  • invalid_chunks - Chunks submitted with this message are not valid.
  • rate_limited - Application has posted too many messages, read the Rate Limit documentation for more information
  • slack_connect_canvas_sharing_blocked - Admin has disabled Canvas File sharing in all Slack Connect communications
  • restricted_action_read_only_channel - Cannot post any message into a read-only channel.
  • invalid_blocks - Blocks submitted with this message are not valid.
  • restricted_action - A workspace preference prevents the authenticated user from posting.
  • invalid_metadata_schema - Invalid metadata schema provided
  • no_text - No message text provided
  • message_not_owned_by_app - The message is not owned by the app.
  • slack_connect_file_link_sharing_blocked - Admin has disabled Slack File sharing in all Slack Connect communications
  • metadata_must_be_sent_from_app - Message metadata can only be posted or updated using an app-level token
  • messages_tab_disabled - Messages tab for the app is disabled.
  • as_user_not_supported - The as_user parameter does not function with workspace apps.
  • not_in_channel - Cannot post user messages to a channel they are not in.
  • msg_blocks_too_many - Max blocks exceeded, blocks are limited to 50 per message.
  • duplicate_message_not_found - No duplicate message exists associated with client_msg_id.
  • msg_blocks_too_long - Blocks submitted with this message are too long.
  • message_limit_exceeded - Members on this team are sending too many messages. For more details, see https://slack.com/help/articles/115002422943-Usage-limits-for-free-workspaces
  • team_not_found - This error occurs if, when using an org-wide token, the channel_name is passed instead of the channel_id.
  • slack_connect_lists_sharing_blocked - Admin has disabled Lists sharing in all Slack Connect communications
  • channel_not_found - Value passed for channel was invalid.
  • too_many_contact_cards - Too many contact_cards were provided with this message. A maximum of 10 contact cards are allowed on a message.
  • too_many_attachments - Too many attachments were provided with this message. A maximum of 100 attachments are allowed on a message.
  • message_not_found - Message not found
  • message_not_in_streaming_state - The message is not in the streaming state.
  • is_archived - Channel has been archived.
  • duplicate_channel_not_found - Channel associated with client_msg_id was invalid.
  • restricted_action_thread_locked - Cannot post replies to a thread that has been locked by admins.
  • restricted_action_non_threadable_channel - Cannot post thread replies into a non_threadable channel.
  • messaging_processing_failed - Failed to process the message.
  • restricted_action_thread_only_channel - Cannot post top-level messages into a thread-only channel.
  • metadata_too_large - Metadata exceeds size limit

See the Common Errors guide for errors returned by every Web API method.

delete(channel, ts, optional_params \\ %{})

Deletes a message.

API reference

Rate limit: Tier 3: 50+ per minute
Scopes:

View on docs.slack.dev ↗

Required Params

  • channel - Channel containing the message to be deleted.
  • ts - Timestamp of the message to be deleted. ex: "1405894322.002768"

Optional Params

  • as_user - (Legacy) Pass true to delete the message as the authed user with chat:write:user scope. Bot users in this context are considered authed users. See legacy as_user parameter below. ex: true

Errors the API can return:

  • cant_delete_message - Authenticated user does not have permission to delete this message.
  • channel_not_found - Value passed for channel was invalid.
  • message_not_found - No message exists with the requested timestamp.

See the Common Errors guide for errors returned by every Web API method.

delete_scheduled_message(channel, scheduled_message_id, optional_params \\ %{})

Deletes a pending scheduled message from the queue.

API reference

Rate limit: Tier 3: 50+ per minute
Scopes:

View on docs.slack.dev ↗

Required Params

  • channel - The channel the scheduled_message is posting to ex: C123456789
  • scheduled_message_id - scheduled_message_id returned from call to chat.scheduleMessage ex: Q1234ABCD

Optional Params

  • as_user - Pass true to delete the message as the authed user with chat:write:user scope. Bot users in this context are considered authed users. If unused or false, the message will be deleted with chat:write:bot scope. ex: true

Errors the API can return:

  • bad_token - The provided token was invalid.
  • channel_not_found - The channel passed is either an invalid ID or does not exist.
  • invalid_scheduled_message_id - The scheduled_message_id passed is either an invalid ID, or the scheduled message it's referencing has already been sent or deleted.

See the Common Errors guide for errors returned by every Web API method.

get_permalink(channel, message_ts, optional_params \\ %{})

Retrieve a permalink URL for a specific extant message

API reference

Rate limit: Special rate limits apply.
Scopes: No scopes required

View on docs.slack.dev ↗

Required Params

  • channel - The ID of the conversation or channel containing the message
  • message_ts - A message's ts value, uniquely identifying it within a channel

Errors the API can return:

  • channel_not_found - Value passed for channel was invalid.
  • message_not_found - The message identified by message_ts could not be found.

See the Common Errors guide for errors returned by every Web API method.

me_message(channel, text, optional_params \\ %{})

Share a me message into a channel.

API reference

Rate limit: Tier 3: 50+ per minute
Scopes:

View on docs.slack.dev ↗

Required Params

  • channel - Channel to send message to. Can be a public channel, private group or IM channel. Can be an encoded ID, or a name.
  • text - Text of the message to send. ex: Hello world

Errors the API can return:

  • channel_not_found - Value passed for channel was invalid.
  • is_archived - Channel has been archived.
  • msg_too_long - Message text is too long
  • no_text - No message text provided
  • not_in_channel - Cannot post user messages to a channel they are not in.
  • rate_limited - Application has posted too many messages, read the Rate Limit documentation for more information

See the Common Errors guide for errors returned by every Web API method.

post_ephemeral(channel, user, optional_params \\ %{})

Sends an ephemeral message to a user in a channel.

API reference

Rate limit: Tier 4: 100+ per minute
Scopes:

View on docs.slack.dev ↗

Required Params

  • channel - Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name.
  • user - id of the user who will receive the ephemeral message. The user should be in the channel specified by the channel argument. ex: U0BPQUNTA

Optional Params

  • as_user - (Legacy) Pass true to post the message as the authed user. Defaults to true if the chat:write:bot scope is not included. Otherwise, defaults to false. ex: true
  • attachments - A JSON-based array of structured attachments, presented as a URL-encoded string. The text field is not enforced as required when using blocks or attachments. ex: [{"pretext": "pre-hello", "text": "text-world"}]
  • blocks - A JSON-based array of structured blocks, presented as a URL-encoded string. The usage of the text field changes depending on whether you're using blocks. The text field is not enforced as required when using blocks or attachments. However, we highly recommended that you include text to provide a fallback when using blocks, as described above. ex: [{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]
  • icon_emoji - Emoji to use as the icon for this message. Overrides icon_url. ex: :chart_with_upwards_trend:
  • icon_url - URL to an image to use as the icon for this message. ex: http://lorempixel.com/48/48
  • link_names - Find and link channel names and usernames. You can specify values for parse and link_names to change formatting behavior. ex: true
  • markdown_text - Accepts message text formatted in markdown. This argument should not be used in conjunction with blocks or text. Limit this field to 12,000 characters. ex: **This is bold text**
  • parse - Change how messages are treated. Defaults to none. See below. Acceptable values: none full mrkdwn false. You can specify values for parse and link_names to change formatting behavior. ex: full
  • text - How this field works and whether it is required depends on other fields you use in your API call. See below for more detail. The usage of the text field changes depending on whether you're using blocks. The text field is not enforced as required when using blocks or attachments. However, we highly recommended that you include text to provide a fallback when using blocks, as described above. ex: Hello world
  • thread_ts - Provide another message's 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.
  • username - Set your bot's user name. ex: My Bot

Errors the API can return:

  • cannot_reply_to_message - This message type cannot have thread replies.
  • channel_not_found - Value passed for channel was invalid.
  • invalid_attachments - Attachments that contain blocks are not valid
  • invalid_blocks - Blocks submitted with this message are not valid
  • invalid_blocks_format - The blocks is not a valid JSON object or doesn't match the Block Kit syntax.
  • is_archived - Channel has been archived.
  • markdown_text_conflict - Markdown text cannot be used in conjunction with blocks or text argument.
  • message_limit_exceeded - Members on this team are sending too many messages. For more details, see https://slack.com/help/articles/115002422943-Usage-limits-for-free-workspaces
  • messages_tab_disabled - Messages tab for the app is disabled.
  • msg_too_long - Message text is too long
  • no_text - No message text provided
  • not_in_channel - Cannot post user messages to a channel they are not in.
  • restricted_action - A workspace preference prevents the authenticated user from posting.
  • too_many_attachments - Too many attachments were provided with this message. A maximum of 100 attachments are allowed on a message.
  • user_not_in_channel - Intended recipient is not in the specified channel.

See the Common Errors guide for errors returned by every Web API method.

post_message(channel, optional_params \\ %{})

Sends a message to a channel.

API reference

Rate limit: Special rate limits apply.
Scopes:

View on docs.slack.dev ↗

Required Params

  • channel - An encoded ID or channel name that represents a channel, private group, or IM channel to send the message to. See below for more details.

Optional Params

  • as_user - (Legacy) Pass true to post the message as the authed user instead of as a bot. Defaults to false. Can only be used by classic apps. See legacy as_user parameter below. ex: true
  • attachments - A JSON-based array of structured attachments, presented as a URL-encoded string. The text field is not enforced as required when using blocks or attachments. ex: [{"pretext": "pre-hello", "text": "text-world"}]
  • blocks - A JSON-based array of structured blocks, presented as a URL-encoded string. The usage of the text field changes depending on whether you're using blocks. The text field is not enforced as required when using blocks or attachments. However, we highly recommended that you include text to provide a fallback when using blocks, as described above. It is expected behavior that screen readers will default to the top-level text field of your post, and will not read the content of any interior blocks in the underlying structure of the message. do not include a top-level text field if the message has blocks, and allow Slack attempt to build it for you by appending content from supported blocks to be read by the screen reader. ex: [{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]
  • current_draft_last_updated_ts - This field represents the timestamp of the draft's last update at the time this API is called. If the current message is a draft, this field can be provided to ensure synchronization with the server. ex: 1524523204.000192
  • icon_emoji - Emoji to use as the icon for this message. Overrides icon_url. ex: :chart_with_upwards_trend:
  • icon_url - URL to an image to use as the icon for this message. ex: http://lorempixel.com/48/48
  • link_names - Find and link user groups. No longer supports linking individual users; use syntax shown in Mentioning Users instead. ex: true
  • markdown_text - Accepts message text formatted in markdown. This argument should not be used in conjunction with blocks or text. Limit this field to 12,000 characters. ex: **This is bold text**
  • metadata - JSON object with event_type and event_payload fields, presented as a URL-encoded string. You can also provide Work Object entity metadata using this parameter. Metadata you post to Slack is accessible to any app or user who is a member of that workspace. ex: {"event_type": "task_created", "event_payload": { "id": "11223", "title": "Redesign Homepage"}}
  • mrkdwn - Disable Slack markup parsing by setting to false. Enabled by default. The behavior of parse is different for text formatted with mrkdwn. By default, or when parse is set to none, mrkdwn formatting is implemented. To ignore mrkdwn formatting, set parse to full. ex: false
  • parse - Change how messages are treated. See below. The behavior of parse is different for text formatted with mrkdwn. By default, or when parse is set to none, mrkdwn formatting is implemented. To ignore mrkdwn formatting, set parse to full. ex: full
  • reply_broadcast - Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false. ex: true
  • text - How this field works and whether it is required depends on other fields you use in your API call. See below for more detail. The usage of the text field changes depending on whether you're using blocks. The text field is not enforced as required when using blocks or attachments. However, we highly recommended that you include text to provide a fallback when using blocks, as described above. It is expected behavior that screen readers will default to the top-level text field of your post, and will not read the content of any interior blocks in the underlying structure of the message. do not include a top-level text field if the message has blocks, and allow Slack attempt to build it for you by appending content from supported blocks to be read by the screen reader. ex: Hello world
  • thread_ts - Provide another message's ts value to make this message a reply. Avoid using a reply's ts value; use its parent instead.
  • unfurl_links - Pass true to enable unfurling of primarily text-based content. If you want to suppress link unfurls in messages containing Block Kit blocks, set unfurl_links and unfurl_media to false. ex: true
  • unfurl_media - Pass false to disable unfurling of media content. If you want to suppress link unfurls in messages containing Block Kit blocks, set unfurl_links and unfurl_media to false. ex: false
  • username - Set your bot's user name. ex: My Bot

Errors the API can return:

  • invalid_metadata_format - Invalid metadata format provided.
  • draft_already_sent - The draft has already been sent.
  • rate_limited - Application has posted too many messages, read the Rate Limit documentation for more information.
  • slack_connect_canvas_sharing_blocked - Admin has disabled Canvas File sharing in all Slack Connect communications.
  • restricted_action_read_only_channel - Cannot post any message into a read-only channel.
  • invalid_blocks - Blocks submitted with this message are not valid.
  • restricted_action - A workspace preference prevents the authenticated user from posting.
  • invalid_metadata_schema - Invalid metadata schema provided.
  • no_text - No message text provided.
  • cannot_reply_to_message - This message type cannot have thread replies.
  • draft_has_conflict - The client draft version is out of sync with the server draft version.
  • slack_connect_file_link_sharing_blocked - Admin has disabled Slack File sharing in all Slack Connect communications.
  • metadata_must_be_sent_from_app - Message metadata can only be posted or updated using an app-level token.
  • draft_not_found - The draft was not found.
  • messages_tab_disabled - Messages tab for the app is disabled.
  • as_user_not_supported - The as_user parameter does not function with workspace apps.
  • not_in_channel - Cannot post user messages to a channel they are not in.
  • draft_already_deleted - The draft has already been deleted.
  • duplicate_message_not_found - No duplicate message exists associated with client_msg_id.
  • msg_blocks_too_long - Blocks submitted with this message are too long.
  • message_limit_exceeded - Members on this team are sending too many messages. For more details, see https://slack.com/help/articles/115002422943-Usage-limits-for-free-workspaces.
  • team_not_found - This error occurs if, when using an org-wide token, the channel_name is passed instead of the channel_id.
  • invalid_blocks_format - The blocks is not a valid JSON object or doesn't match the Block Kit syntax.
  • slack_connect_lists_sharing_blocked - Admin has disabled Lists sharing in all Slack Connect communications.
  • channel_not_found - Value passed for channel was invalid.
  • too_many_contact_cards - Too many contact_cards were provided with this message. A maximum of 10 contact cards are allowed on a message.
  • too_many_attachments - Too many attachments were provided with this message. A maximum of 100 attachments are allowed on a message.
  • markdown_text_conflict - Markdown text cannot be used in conjunction with blocks or text argument.
  • attachment_payload_limit_exceeded - Attachment payload size is too long.
  • is_archived - Channel has been archived.
  • duplicate_channel_not_found - Channel associated with client_msg_id was invalid.
  • restricted_action_thread_locked - Cannot post replies to a thread that has been locked by admins.
  • missing_file_data - Attempted to share a file but some required data was missing.
  • restricted_action_non_threadable_channel - Cannot post thread replies into a non_threadable channel.
  • restricted_action_thread_only_channel - Cannot post top-level messages into a thread-only channel.
  • metadata_too_large - Metadata exceeds size limit.

See the Common Errors guide for errors returned by every Web API method.

schedule_message(channel, post_at, optional_params \\ %{})

Schedules a message to be sent to a channel.

API reference

Rate limit: Tier 3: 50+ per minute
Scopes:

View on docs.slack.dev ↗

Required Params

  • channel - Channel, private group, or DM channel to send message to. Can be an encoded ID, or a name. See below for more details.
  • post_at - Unix timestamp representing the future time the message should post to Slack. ex: 299876400

Optional Params

  • as_user - Set to true to post the message as the authed user, instead of as a bot. Defaults to false. Cannot be used by new Slack apps. See chat.postMessage. ex: true
  • attachments - A JSON-based array of structured attachments, presented as a URL-encoded string. ex: [{"pretext": "pre-hello", "text": "text-world"}]
  • blocks - A JSON-based array of structured blocks, presented as a URL-encoded string. ex: [{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]
  • link_names - Find and link user groups. No longer supports linking individual users; use syntax shown in Mentioning Users instead. ex: true
  • markdown_text - Accepts message text formatted in markdown. This argument should not be used in conjunction with blocks or text. Limit this field to 12,000 characters. ex: **This is bold text**
  • metadata - JSON object with event_type and event_payload fields, presented as a URL-encoded string. Metadata you post to Slack is accessible to any app or user who is a member of that workspace. ex: {"event_type": "task_created", "event_payload": { "id": "11223", "title": "Redesign Homepage"}}
  • parse - Change how messages are treated. See chat.postMessage. Acceptable values: none full ex: full
  • reply_broadcast - Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false. ex: true
  • text - How this field works and whether it is required depends on other fields you use in your API call. See below for more detail. ex: Hello world
  • thread_ts - Provide another message's ts value to make this message a reply. Avoid using a reply's ts value; use its parent instead.
  • unfurl_links - Pass true to enable unfurling of primarily text-based content. ex: true
  • unfurl_media - Pass false to disable unfurling of media content. ex: false

Errors the API can return:

  • channel_not_found - Value passed for channel was invalid.
  • invalid_blocks - Blocks submitted with this message are not valid
  • invalid_blocks_format - The blocks is not a valid JSON object or doesn't match the Block Kit syntax.
  • invalid_metadata_format - Invalid metadata format provided
  • invalid_metadata_schema - Invalid metadata schema provided
  • invalid_time - value passed for post_time was invalid.
  • invalid_token - The passed token is invalid or not supported by this method.
  • is_archived - Channel has been archived.
  • markdown_text_conflict - Markdown text cannot be used in conjunction with blocks or text argument.
  • message_limit_exceeded - Members on this team are sending too many messages. For more details, see https://slack.com/help/articles/115002422943-Usage-limits-for-free-workspaces
  • metadata_must_be_sent_from_app - Message metadata can only be posted or updated using an app-level token
  • metadata_too_large - Metadata exceeds size limit
  • msg_too_long - Message text is too long
  • no_text - No message text provided
  • not_in_channel - Cannot post user messages to a channel they are not in.
  • rate_limited - Application has posted too many messages, read the Rate Limit documentation for more information
  • restricted_action - A workspace preference prevents the authenticated user from posting.
  • restricted_action_non_threadable_channel - Cannot post thread replies into a non_threadable channel.
  • restricted_action_read_only_channel - Cannot post any message into a read-only channel.
  • restricted_action_thread_only_channel - Cannot post top-level messages into a thread-only channel.
  • restricted_too_many - Too many messages were scheduled in the channel for a given period. See usage info for additional details
  • slack_connect_file_link_sharing_blocked - Admin has disabled Slack File sharing in all Slack Connect communications
  • time_in_past - value passed for post_time was in the past.
  • time_too_far - value passed for post_time was too far into the future.
  • too_many_attachments - Too many attachments were provided with this message. A maximum of 100 attachments are allowed on a message.

See the Common Errors guide for errors returned by every Web API method.

start_stream(channel, thread_ts, optional_params \\ %{})

Starts a new streaming conversation.

API reference

Rate limit: Tier 2: 20+ per minute
Scopes:

View on docs.slack.dev ↗

Required Params

  • channel - An encoded ID that represents a channel thread or DM.
  • thread_ts - Provide another message's ts value to reply to. Streamed messages should always be replies to a user request. ex: 1721609600.123456

Optional Params

  • chunks - Array of streaming chunks.
  • icon_emoji - Emoji to use as the icon for this message. Overrides icon_url. ex: :chart_with_upwards_trend:
  • icon_url - Image URL to use as the icon for this message. ex: http://lorempixel.com/48/48
  • markdown_text - Accepts message text formatted in markdown. Limit this field to 12,000 characters. ex: **This is bold text**
  • recipient_team_id - The encoded ID of the team the user receiving the streaming text belongs to. Required when streaming to channels. ex: T0123456789
  • recipient_user_id - The encoded ID of the user to receive the streaming text. Required when streaming to channels.
  • task_display_mode - Specifies how tasks are displayed in the message. A timeline displays individual tasks with text in sequential order, plan displays all tasks together, with the first tasks's placement determining the placement of the rest of the tasks, and dense collapses consecutive tool calls into a single summarized task card. ex: plan
  • username - The bot's username to display. ex: My Bot

Errors the API can return:

  • channel_not_found - Value passed for channel was invalid.
  • channel_type_not_supported - Channel type not supported
  • duplicate_channel_not_found - Channel associated with client_msg_id was invalid.
  • duplicate_message_not_found - No duplicate message exists associated with client_msg_id.
  • invalid_blocks - Blocks submitted with this message are not valid
  • invalid_blocks_format - The blocks is not a valid JSON object or doesn't match the Block Kit syntax.
  • invalid_chunks - Chunks submitted with this message are not valid.
  • invalid_metadata_format - Invalid metadata format provided
  • invalid_metadata_schema - Invalid metadata schema provided
  • is_archived - Channel has been archived.
  • message_limit_exceeded - Members on this team are sending too many messages. For more details, see https://slack.com/help/articles/115002422943-Usage-limits-for-free-workspaces
  • messages_tab_disabled - Messages tab for the app is disabled.
  • messaging_processing_failed - Failed to process the message.
  • metadata_must_be_sent_from_app - Message metadata can only be posted or updated using an app-level token
  • metadata_too_large - Metadata exceeds size limit
  • missing_recipient_team_id - Missing recipient team ID.
  • missing_recipient_user_id - Missing recipient user ID.
  • msg_blocks_too_long - Blocks submitted with this message are too long.
  • msg_blocks_too_many - Max blocks exceeded, blocks are limited to 50 per message.
  • no_text - No message text provided
  • not_in_channel - Cannot post user messages to a channel they are not in.
  • rate_limited - Application has posted too many messages, read the Rate Limit documentation for more information
  • restricted_action - A workspace preference prevents the authenticated user from posting.
  • restricted_action_non_threadable_channel - Cannot post thread replies into a non_threadable channel.
  • restricted_action_read_only_channel - Cannot post any message into a read-only channel.
  • restricted_action_thread_locked - Cannot post replies to a thread that has been locked by admins.
  • restricted_action_thread_only_channel - Cannot post top-level messages into a thread-only channel.
  • slack_connect_canvas_sharing_blocked - Admin has disabled Canvas File sharing in all Slack Connect communications
  • slack_connect_file_link_sharing_blocked - Admin has disabled Slack File sharing in all Slack Connect communications
  • slack_connect_lists_sharing_blocked - Admin has disabled Lists sharing in all Slack Connect communications
  • team_not_found - This error occurs if, when using an org-wide token, the channel_name is passed instead of the channel_id.
  • user_not_found - User not found.

See the Common Errors guide for errors returned by every Web API method.

stop_stream(channel, ts, optional_params \\ %{})

Stops a streaming conversation.

API reference

Rate limit: Tier 2: 20+ per minute
Scopes:

View on docs.slack.dev ↗

Required Params

  • channel - An encoded ID that represents a channel, private group, or DM
  • ts - The timestamp of the streaming message.

Optional Params

  • blocks - A list of blocks that will be rendered at the bottom of the finalized message. The blocks array has a limit of 50, which is a separate limit from the blocks sent via the chunks parameter. Therefore you can have 50 blocks sent via the chunks parameter and 50 blocks sent via the chat.stopStream API method's blocks array, for 100 blocks total. Note that any blocks in the blocks array will be rendered after anything passed via chunks or markdown_text when the stream is completed.
  • chunks - Array of streaming chunks. The blocks array has a limit of 50, which is a separate limit from the blocks sent via the chunks parameter. Therefore you can have 50 blocks sent via the chunks parameter and 50 blocks sent via the chat.stopStream API method's blocks array, for 100 blocks total. Note that any blocks in the blocks array will be rendered after anything passed via chunks or markdown_text when the stream is completed.
  • markdown_text - Accepts message text formatted in markdown. Limit this field to 12,000 characters. Note that any blocks in the blocks array will be rendered after anything passed via chunks or markdown_text when the stream is completed. ex: **This is bold text**
  • metadata - JSON object with event_type and event_payload fields, presented as a URL-encoded string. Metadata you post to Slack is accessible to any app or user who is a member of that workspace. ex: {"event_type": "task_created", "event_payload": { "id": "11223", "title": "Redesign Homepage"}}

Errors the API can return:

  • invalid_metadata_format - Invalid metadata format provided
  • channel_type_not_supported - Channel type not supported.
  • invalid_chunks - Chunks submitted with this message are not valid.
  • rate_limited - Application has posted too many messages, read the Rate Limit documentation for more information
  • slack_connect_canvas_sharing_blocked - Admin has disabled Canvas File sharing in all Slack Connect communications
  • restricted_action_read_only_channel - Cannot post any message into a read-only channel.
  • invalid_blocks - Blocks submitted with this message are not valid.
  • restricted_action - A workspace preference prevents the authenticated user from posting.
  • invalid_metadata_schema - Invalid metadata schema provided
  • no_text - No message text provided
  • cannot_reply_to_message - This message type cannot have thread replies.
  • message_not_owned_by_app - The message is not owned by the app.
  • slack_connect_file_link_sharing_blocked - Admin has disabled Slack File sharing in all Slack Connect communications
  • metadata_must_be_sent_from_app - Message metadata can only be posted or updated using an app-level token
  • messages_tab_disabled - Messages tab for the app is disabled.
  • as_user_not_supported - The as_user parameter does not function with workspace apps.
  • not_in_channel - Cannot post user messages to a channel they are not in.
  • msg_blocks_too_many - Max blocks exceeded, blocks are limited to 50 per message.
  • duplicate_message_not_found - No duplicate message exists associated with client_msg_id.
  • msg_blocks_too_long - Blocks submitted with this message are too long.
  • message_limit_exceeded - Members on this team are sending too many messages. For more details, see https://slack.com/help/articles/115002422943-Usage-limits-for-free-workspaces
  • team_not_found - This error occurs if, when using an org-wide token, the channel_name is passed instead of the channel_id.
  • slack_connect_lists_sharing_blocked - Admin has disabled Lists sharing in all Slack Connect communications
  • channel_not_found - Value passed for channel was invalid.
  • too_many_contact_cards - Too many contact_cards were provided with this message. A maximum of 10 contact cards are allowed on a message.
  • too_many_attachments - Too many attachments were provided with this message. A maximum of 100 attachments are allowed on a message.
  • message_not_found - The message was not found.
  • attachment_payload_limit_exceeded - Attachment payload size is too long.
  • message_not_in_streaming_state - The message is not in a streaming state.
  • is_archived - Channel has been archived.
  • duplicate_channel_not_found - Channel associated with client_msg_id was invalid.
  • restricted_action_thread_locked - Cannot post replies to a thread that has been locked by admins.
  • missing_file_data - Attempted to share a file but some required data was missing.
  • restricted_action_non_threadable_channel - Cannot post thread replies into a non_threadable channel.
  • restricted_action_thread_only_channel - Cannot post top-level messages into a thread-only channel.
  • metadata_too_large - Metadata exceeds size limit

See the Common Errors guide for errors returned by every Web API method.

unfurl(optional_params \\ %{})

Provide custom unfurl behavior for user-posted URLs

API reference

Rate limit: Tier 3: 50+ per minute
Scopes:

View on docs.slack.dev ↗

Optional Params

  • channel - Channel ID of the message. Both channel and ts must be provided together, or unfurl_id and source must be provided together. Required for public channels. Both unfurl_id and source must be provided together, or channel and ts must be provided together. The first time this method is executed with a particular ts and channel (or unfurl_id and source) combination, the valid unfurls attachments you provide will be attached to the message. Subsequent attempts with the same ts and channel values will modify the same attachments, rather than adding more. The ts value you supply must correspond to a message in the specified channel.
  • source - The source of the link to unfurl. The source may either be composer, when the link is inside the message composer, or conversations_history, when the link has been posted to a conversation. Acceptable values: composer conversations_history. Both unfurl_id and source must be provided together, or channel and ts must be provided together. The first time this method is executed with a particular ts and channel (or unfurl_id and source) combination, the valid unfurls attachments you provide will be attached to the message. ex: composer
  • ts - Timestamp of the message to add unfurl behavior to. Required for public channels. Both unfurl_id and source must be provided together, or channel and ts must be provided together. The first time this method is executed with a particular ts and channel (or unfurl_id and source) combination, the valid unfurls attachments you provide will be attached to the message. Subsequent attempts with the same ts and channel values will modify the same attachments, rather than adding more. The ts value you supply must correspond to a message in the specified channel.
  • unfurl_id - The ID of the link to unfurl. Both unfurl_id and source must be provided together, or channel and ts must be provided together. Both unfurl_id and source must be provided together, or channel and ts must be provided together. The first time this method is executed with a particular ts and channel (or unfurl_id and source) combination, the valid unfurls attachments you provide will be attached to the message. ex: Uxxxxxxx-909b5454-75f8-4ac4-b325-1b40e230bbd8
  • unfurls - URL-encoded JSON map with keys set to URLs featured in the the message, pointing to their unfurl blocks or message attachments. Required for public channels. The first time this method is executed with a particular ts and channel (or unfurl_id and source) combination, the valid unfurls attachments you provide will be attached to the message.
  • user_auth_blocks - Provide a JSON based array of structured blocks presented as URL-encoded string to send as an ephemeral message to the user as invitation to authenticate further and enable full unfurling behavior. Or, you can send an ephemeral message to that user by providing a simple string-based user_auth_message value or JSON array of blocks using user_auth_blocks. Using both properties shows the user_auth_message in a notification and the user_auth_blocks in the ephemeral message.
  • user_auth_message - Provide a simply-formatted string to send as an ephemeral message to the user as invitation to authenticate further and enable full unfurling behavior. Provides two buttons, Not now or Never ask me again. Or, you can send an ephemeral message to that user by providing a simple string-based user_auth_message value or JSON array of blocks using user_auth_blocks. Using both properties shows the user_auth_message in a notification and the user_auth_blocks in the ephemeral message. Specifying user_auth_url or user_auth_message will automatically imply user_auth_required being set to true. If both user_auth_url and user_auth_message are provided, user_auth_message takes precedence.
  • user_auth_required - Set to true or 1 to indicate the user must install your Slack app to trigger unfurls for this domain. Specifying user_auth_url or user_auth_message will automatically imply user_auth_required being set to true.
  • user_auth_url - Send users to this custom URL where they will complete authentication in your app to fully trigger unfurling. Value should be properly URL-encoded. Specifying user_auth_url or user_auth_message will automatically imply user_auth_required being set to true. If both user_auth_url and user_auth_message are provided, user_auth_message takes precedence. ex: https://example.com/onboarding?user_id=xxx

Errors the API can return:

  • cannot_auth_user - The current user cannot be authenticated.
  • cannot_find_channel - The specified channel could not be located for this token.
  • cannot_find_message - The ts value in the request does not match a message.
  • cannot_find_service - A record of your app being allowed to unfurl for this workspace could not be found.
  • cannot_parse_attachment - The provided unfurls argument could not be parsed or understood.
  • cannot_prompt - The current user has already interacted with and dismissed a prompt for this application.
  • cannot_unfurl_message - The URL cannot be unfurled because the URL provided does not appear in the message.
  • cannot_unfurl_url - The URL cannot be unfurled. This error may be returned if you haven't acknowledged a link_shared event tied to the same URL. It is also returned when the domain appears in a workspace's administrative blocklists.
  • invalid_metadata_format - The metadata parameter cannot be JSON-decoded into the expected format.
  • invalid_source - The unfurl source is invalid.
  • invalid_unfurl_id - The unfurl ID is invalid.
  • invalid_unfurls_format - The unfurls parameter cannot be JSON-decoded into a map of URLs to attachments.
  • missing_channel - The request is missing the channel parameter
  • missing_source - The request is missing the source parameter.
  • missing_ts - The request is missing the ts parameter
  • missing_unfurl_id - The request is missing the unfurl_id parameter.
  • missing_unfurls - The request is missing the unfurls parameter.

See the Common Errors guide for errors returned by every Web API method.

update(channel, ts, optional_params \\ %{})

Updates a message.

API reference

Rate limit: Tier 3: 50+ per minute
Scopes:

View on docs.slack.dev ↗

Required Params

  • channel - Channel containing the message to be updated. For direct messages, ensure that this value is a DM ID (starts with D) instead of a User ID (starts with either U or W).
  • ts - Timestamp of the message to be updated. ex: "1405894322.002768"

Optional Params

  • as_user - Pass true to update the message as the authed user. Bot users in this context are considered authed users. ex: true
  • attachments - A JSON-based array of structured attachments, presented as a URL-encoded string. Similarly, the attachments field is required when not presenting text. ex: [{"pretext": "pre-hello", "text": "text-world"}]
  • blocks - A JSON-based array of structured blocks, presented as a URL-encoded string. This method will behave differently depending on whether blocks or text is supplied. Slack will always try to render the message using blocks, and use text only for notifications. If you don't include blocks, the message's previous blocks will only be retained if the text argument is not provided. If the text argument is provided and blocks are not provided, the blocks will be removed, and the provided text will be used for message rendering. If blocks are used and a message is being updated, the edited flag will not be displayed on the message (the flag will be displayed on the message if using text). ex: [{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]
  • file_ids - Array of new file ids that will be sent with this message. ex: F013GKY52QK,F013GL22D0T or ["F013GKY52QK","F013GL22D0T"]
  • link_names - Find and link channel names 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. ex: true
  • markdown_text - Accepts message text formatted in markdown. This argument should not be used in conjunction with blocks or text. Limit this field to 12,000 characters. ex: **This is bold text**
  • metadata - JSON object with event_type and event_payload fields, presented as a URL-encoded string. If you don't include this field, the message's previous metadata will be retained. To remove previous metadata, include an empty object for this field. Metadata you post to Slack is accessible to any app or user who is a member of that workspace. ex: {"event_type": "task_created", "event_payload": { "id": "11223", "title": "Redesign Homepage"}}
  • parse - Change how messages are treated. 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. ex: none
  • reply_broadcast - Broadcast an existing thread reply to make it visible to everyone in the channel or conversation. ex: true
  • text - How this field works and whether it is required depends on other fields you use in your API call. See below for more detail. This method will behave differently depending on whether blocks or text is supplied. Slack will always try to render the message using blocks, and use text only for notifications. If you don't include blocks, the message's previous blocks will only be retained if the text argument is not provided. If the text argument is provided and blocks are not provided, the blocks will be removed, and the provided text will be used for message rendering. If blocks are used and a message is being updated, the edited flag will not be displayed on the message (the flag will be displayed on the message if using text). Similarly, the attachments field is required when not presenting text. ex: Hello world
  • unfurled_attachments - A JSON-based array of structured attachments, presented as a URL-encoded string. ex: [{"pretext": "pre-hello", "text": "text-world"}]

Errors the API can return:

  • edit_window_closed - The message cannot be edited due to the team message edit settings
  • max_file_sharing_exceeded - Exceeded max allowed files shared.
  • invalid_metadata_format - Invalid metadata format provided
  • slack_connect_canvas_sharing_blocked - Admin has disabled sharing of canvas links in all Slack Connect messages.
  • invalid_blocks - The blocks were invalid for the requesting user.
  • invalid_metadata_schema - Invalid metadata schema provided
  • no_text - No message text provided
  • slack_connect_blocked_file_type - Files with certain extensions are blocked from being uploaded in all Slack Connect messages.
  • invalid_attachments - The attachments were invalid.
  • cant_update_message - Authenticated user does not have permission to update this message.
  • slack_connect_file_link_sharing_blocked - Admin has disabled Slack file sharing in all Slack Connect messages.
  • metadata_must_be_sent_from_app - Message metadata can only be posted or updated using an app-level token
  • file_share_limit_reached - The file has reached the share limit.
  • slack_connect_clip_sharing_blocked - Admin has disabled Clip uploads in Slack Connect channels.
  • streaming_state_conflict - The message is currently streaming text and cannot be edited.
  • as_user_not_supported - The as_user parameter does not function with workspace apps.
  • posting_to_channel_denied - The user does not have permission to share files in this channel.
  • update_failed - Internal update failure.
  • no_dual_broadcast_content_update - Can't broadcast an old reply and update the content at the same time.
  • message_limit_exceeded - Members on this team are sending too many messages. For more details, see https://slack.com/help/articles/115002422943-Usage-limits-for-free-workspaces.
  • unable_to_share_files - Sharing the files failed.
  • team_not_found - Team associated with the message and channel could not be found.
  • invalid_blocks_format - The blocks array is not a valid JSON object or doesn't match the Block Kit syntax.
  • slack_connect_file_upload_sharing_blocked - Admin has disabled file uploads in all Slack Connect messages.
  • channel_not_found - Value passed for channel was invalid.
  • file_is_deleted - The file is deleted.
  • external_channel_migrating - The channel is in the process of migrating and so the message cannot be updated at this time.
  • too_many_attachments - Too many attachments were provided with this message. A maximum of 100 attachments are allowed on a message.
  • message_not_found - No message exists with the requested timestamp.
  • msg_too_long - Message text is too long. The text field cannot exceed 4,000 characters.
  • markdown_text_conflict - Markdown text cannot be used in conjunction with blocks or text argument.
  • file_deleted - File to share deleted.
  • cant_broadcast_message - Unable to broadcast this message.
  • file_not_found - One or more of the provided file IDs could not be found.
  • blocked_file_type - Admin has disabled uploading this type of file.
  • is_inactive - The message cannot be edited within a frozen, archived or deleted channel.
  • block_mismatch - Rich-text blocks cannot be replaced with non-rich-text blocks
  • metadata_too_large - Metadata exceeds size limit

See the Common Errors guide for errors returned by every Web API method.