Slack. Web. Chat
(SlackKit v1.0.0-alpha.0)
View Source
Summary
Functions
Appends text to an existing streaming conversation.
Deletes a message.
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
Updates a message.
Functions
Appends text to an existing streaming conversation.
API reference
Rate limit: Tier 4: 100+ per minute
Scopes:
- Bot token:
chat:write
Required Params
channel- An encoded ID that represents a channel, private group, or DMmarkdown_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 providedchannel_type_not_supported- Channel type not supportedstopped_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 informationslack_connect_canvas_sharing_blocked- Admin has disabled Canvas File sharing in all Slack Connect communicationsrestricted_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 providedno_text- No message text providedmessage_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 communicationsmetadata_must_be_sent_from_app- Message metadata can only be posted or updated using an app-level tokenmessages_tab_disabled- Messages tab for the app is disabled.as_user_not_supported- Theas_userparameter 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 withclient_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-workspacesteam_not_found- This error occurs if, when using an org-wide token, thechannel_nameis passed instead of thechannel_id.slack_connect_lists_sharing_blocked- Admin has disabled Lists sharing in all Slack Connect communicationschannel_not_found- Value passed forchannelwas 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 foundmessage_not_in_streaming_state- The message is not in the streaming state.is_archived- Channel has been archived.duplicate_channel_not_found- Channel associated withclient_msg_idwas 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.
Deletes a message.
API reference
Rate limit: Tier 3: 50+ per minute
Scopes:
- Bot token:
chat:write - User token:
chat:write
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 withchat:write:userscope. Bot users in this context are considered authed users. See legacyas_userparameter 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 forchannelwas invalid.message_not_found- No message exists with the requested timestamp.
See the Common Errors guide for errors returned by every Web API method.
Deletes a pending scheduled message from the queue.
API reference
Rate limit: Tier 3: 50+ per minute
Scopes:
- Bot token:
chat:write - User token:
chat:write
Required Params
channel- The channel the scheduled_message is posting to ex:C123456789scheduled_message_id-scheduled_message_idreturned from call to chat.scheduleMessage ex:Q1234ABCD
Optional Params
as_user- Pass true to delete the message as the authed user withchat:write:userscope. Bot users in this context are considered authed users. If unused or false, the message will be deleted withchat:write:botscope. ex:true
Errors the API can return:
bad_token- The providedtokenwas invalid.channel_not_found- Thechannelpassed is either an invalid ID or does not exist.invalid_scheduled_message_id- Thescheduled_message_idpassed 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.
Retrieve a permalink URL for a specific extant message
API reference
Rate limit: Special rate limits apply.
Scopes: No scopes required
Required Params
channel- The ID of the conversation or channel containing the messagemessage_ts- A message'stsvalue, uniquely identifying it within a channel
Errors the API can return:
channel_not_found- Value passed forchannelwas invalid.message_not_found- The message identified bymessage_tscould not be found.
See the Common Errors guide for errors returned by every Web API method.
Share a me message into a channel.
API reference
Rate limit: Tier 3: 50+ per minute
Scopes:
- Bot token:
chat:write - User token:
chat:write
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 forchannelwas invalid.is_archived- Channel has been archived.msg_too_long- Message text is too longno_text- No message text providednot_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.
Sends an ephemeral message to a user in a channel.
API reference
Rate limit: Tier 4: 100+ per minute
Scopes:
- Bot token:
chat:write - User token:
chat:write
Required Params
channel- Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name.user-idof the user who will receive the ephemeral message. The user should be in the channel specified by thechannelargument. 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:trueattachments- A JSON-based array of structured attachments, presented as a URL-encoded string. Thetextfield is not enforced as required when usingblocksorattachments. ex:[{"pretext": "pre-hello", "text": "text-world"}]blocks- A JSON-based array of structured blocks, presented as a URL-encoded string. The usage of thetextfield changes depending on whether you're usingblocks. Thetextfield is not enforced as required when usingblocksorattachments. However, we highly recommended that you includetextto provide a fallback when usingblocks, as described above. ex:[{"type": "section", "text": {"type": "plain_text", "text": "Hello world"}}]icon_emoji- Emoji to use as the icon for this message. Overridesicon_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/48link_names- Find and link channel names and usernames. You can specify values forparseandlink_namesto change formatting behavior. ex:truemarkdown_text- Accepts message text formatted in markdown. This argument should not be used in conjunction withblocksortext. Limit this field to 12,000 characters. ex:**This is bold text**parse- Change how messages are treated. Defaults tonone. See below. Acceptable values:nonefullmrkdwnfalse. You can specify values forparseandlink_namesto change formatting behavior. ex:fulltext- 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 thetextfield changes depending on whether you're usingblocks. Thetextfield is not enforced as required when usingblocksorattachments. However, we highly recommended that you includetextto provide a fallback when usingblocks, as described above. ex:Hello worldthread_ts- Provide another message'stsvalue to post this message in a thread. Avoid using a reply'stsvalue; 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 forchannelwas invalid.invalid_attachments- Attachments that contain blocks are not validinvalid_blocks- Blocks submitted with this message are not validinvalid_blocks_format- Theblocksis 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 withblocksortextargument.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-workspacesmessages_tab_disabled- Messages tab for the app is disabled.msg_too_long- Message text is too longno_text- No message text providednot_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.
Sends a message to a channel.
API reference
Rate limit: Special rate limits apply.
Scopes:
- Bot token:
chat:write - User token:
chat:write
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 legacyas_userparameter below. ex:trueattachments- A JSON-based array of structured attachments, presented as a URL-encoded string. Thetextfield is not enforced as required when usingblocksorattachments. ex:[{"pretext": "pre-hello", "text": "text-world"}]blocks- A JSON-based array of structured blocks, presented as a URL-encoded string. The usage of thetextfield changes depending on whether you're usingblocks. Thetextfield is not enforced as required when usingblocksorattachments. However, we highly recommended that you includetextto provide a fallback when usingblocks, as described above. It is expected behavior that screen readers will default to the top-leveltextfield of your post, and will not read the content of any interiorblocksin the underlying structure of the message. do not include a top-leveltextfield if the message hasblocks, and allow Slack attempt to build it for you by appending content from supportedblocksto 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.000192icon_emoji- Emoji to use as the icon for this message. Overridesicon_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/48link_names- Find and link user groups. No longer supports linking individual users; use syntax shown in Mentioning Users instead. ex:truemarkdown_text- Accepts message text formatted in markdown. This argument should not be used in conjunction withblocksortext. 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 tofalse. Enabled by default. The behavior ofparseis different for text formatted withmrkdwn. By default, or whenparseis set tonone,mrkdwnformatting is implemented. To ignoremrkdwnformatting, setparsetofull. ex:falseparse- Change how messages are treated. See below. The behavior ofparseis different for text formatted withmrkdwn. By default, or whenparseis set tonone,mrkdwnformatting is implemented. To ignoremrkdwnformatting, setparsetofull. ex:fullreply_broadcast- Used in conjunction withthread_tsand indicates whether reply should be made visible to everyone in the channel or conversation. Defaults tofalse. ex:truetext- 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 thetextfield changes depending on whether you're usingblocks. Thetextfield is not enforced as required when usingblocksorattachments. However, we highly recommended that you includetextto provide a fallback when usingblocks, as described above. It is expected behavior that screen readers will default to the top-leveltextfield of your post, and will not read the content of any interiorblocksin the underlying structure of the message. do not include a top-leveltextfield if the message hasblocks, and allow Slack attempt to build it for you by appending content from supportedblocksto be read by the screen reader. ex:Hello worldthread_ts- Provide another message'stsvalue to make this message a reply. Avoid using a reply'stsvalue; 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, setunfurl_linksandunfurl_mediato false. ex:trueunfurl_media- Pass false to disable unfurling of media content. If you want to suppress link unfurls in messages containing Block Kit blocks, setunfurl_linksandunfurl_mediato false. ex:falseusername- 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- Theas_userparameter 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 withclient_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, thechannel_nameis passed instead of thechannel_id.invalid_blocks_format- Theblocksis 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 forchannelwas 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 withblocksortextargument.attachment_payload_limit_exceeded- Attachment payload size is too long.is_archived- Channel has been archived.duplicate_channel_not_found- Channel associated withclient_msg_idwas 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.
Schedules a message to be sent to a channel.
API reference
Rate limit: Tier 3: 50+ per minute
Scopes:
- Bot token:
chat:write - User token:
chat:write
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 totrueto 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:trueattachments- 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:truemarkdown_text- Accepts message text formatted in markdown. This argument should not be used in conjunction withblocksortext. 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:nonefullex:fullreply_broadcast- Used in conjunction withthread_tsand indicates whether reply should be made visible to everyone in the channel or conversation. Defaults tofalse. ex:truetext- 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 worldthread_ts- Provide another message'stsvalue to make this message a reply. Avoid using a reply'stsvalue; use its parent instead.unfurl_links- Pass true to enable unfurling of primarily text-based content. ex:trueunfurl_media- Pass false to disable unfurling of media content. ex:false
Errors the API can return:
channel_not_found- Value passed forchannelwas invalid.invalid_blocks- Blocks submitted with this message are not validinvalid_blocks_format- Theblocksis not a valid JSON object or doesn't match the Block Kit syntax.invalid_metadata_format- Invalid metadata format providedinvalid_metadata_schema- Invalid metadata schema providedinvalid_time- value passed forpost_timewas 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 withblocksortextargument.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-workspacesmetadata_must_be_sent_from_app- Message metadata can only be posted or updated using an app-level tokenmetadata_too_large- Metadata exceeds size limitmsg_too_long- Message text is too longno_text- No message text providednot_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 informationrestricted_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 detailsslack_connect_file_link_sharing_blocked- Admin has disabled Slack File sharing in all Slack Connect communicationstime_in_past- value passed forpost_timewas in the past.time_too_far- value passed forpost_timewas 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.
Starts a new streaming conversation.
API reference
Rate limit: Tier 2: 20+ per minute
Scopes:
- Bot token:
chat:write
Required Params
channel- An encoded ID that represents a channel thread or DM.thread_ts- Provide another message'stsvalue 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. Overridesicon_url. ex::chart_with_upwards_trend:icon_url- Image URL to use as the icon for this message. ex:http://lorempixel.com/48/48markdown_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:T0123456789recipient_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. Atimelinedisplays individual tasks with text in sequential order,plandisplays all tasks together, with the first tasks's placement determining the placement of the rest of the tasks, anddensecollapses consecutive tool calls into a single summarized task card. ex:planusername- The bot's username to display. ex:My Bot
Errors the API can return:
channel_not_found- Value passed forchannelwas invalid.channel_type_not_supported- Channel type not supportedduplicate_channel_not_found- Channel associated withclient_msg_idwas invalid.duplicate_message_not_found- No duplicate message exists associated withclient_msg_id.invalid_blocks- Blocks submitted with this message are not validinvalid_blocks_format- Theblocksis 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 providedinvalid_metadata_schema- Invalid metadata schema providedis_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-workspacesmessages_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 tokenmetadata_too_large- Metadata exceeds size limitmissing_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 providednot_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 informationrestricted_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 communicationsslack_connect_file_link_sharing_blocked- Admin has disabled Slack File sharing in all Slack Connect communicationsslack_connect_lists_sharing_blocked- Admin has disabled Lists sharing in all Slack Connect communicationsteam_not_found- This error occurs if, when using an org-wide token, thechannel_nameis passed instead of thechannel_id.user_not_found- User not found.
See the Common Errors guide for errors returned by every Web API method.
Stops a streaming conversation.
API reference
Rate limit: Tier 2: 20+ per minute
Scopes:
- Bot token:
chat:write
Required Params
channel- An encoded ID that represents a channel, private group, or DMts- The timestamp of the streaming message.
Optional Params
blocks- A list of blocks that will be rendered at the bottom of the finalized message. Theblocksarray has a limit of 50, which is a separate limit from theblockssent via thechunksparameter. Therefore you can have 50blockssent via thechunksparameter and 50blockssent via thechat.stopStreamAPI method'sblocksarray, for 100 blocks total. Note that any blocks in theblocksarray will be rendered after anything passed viachunksormarkdown_textwhen the stream is completed.chunks- Array of streaming chunks. Theblocksarray has a limit of 50, which is a separate limit from theblockssent via thechunksparameter. Therefore you can have 50blockssent via thechunksparameter and 50blockssent via thechat.stopStreamAPI method'sblocksarray, for 100 blocks total. Note that any blocks in theblocksarray will be rendered after anything passed viachunksormarkdown_textwhen the stream is completed.markdown_text- Accepts message text formatted in markdown. Limit this field to 12,000 characters. Note that any blocks in theblocksarray will be rendered after anything passed viachunksormarkdown_textwhen 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 providedchannel_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 informationslack_connect_canvas_sharing_blocked- Admin has disabled Canvas File sharing in all Slack Connect communicationsrestricted_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 providedno_text- No message text providedcannot_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 communicationsmetadata_must_be_sent_from_app- Message metadata can only be posted or updated using an app-level tokenmessages_tab_disabled- Messages tab for the app is disabled.as_user_not_supported- Theas_userparameter 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 withclient_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-workspacesteam_not_found- This error occurs if, when using an org-wide token, thechannel_nameis passed instead of thechannel_id.slack_connect_lists_sharing_blocked- Admin has disabled Lists sharing in all Slack Connect communicationschannel_not_found- Value passed forchannelwas 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 withclient_msg_idwas 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.
Provide custom unfurl behavior for user-posted URLs
API reference
Rate limit: Tier 3: 50+ per minute
Scopes:
- Bot token:
links:write - User token:
links:write
Optional Params
channel- Channel ID of the message. Bothchannelandtsmust be provided together, orunfurl_idandsourcemust be provided together. Required for public channels. Bothunfurl_idandsourcemust be provided together, orchannelandtsmust be provided together. The first time this method is executed with a particulartsandchannel(orunfurl_idandsource) combination, the validunfurlsattachments you provide will be attached to the message. Subsequent attempts with the sametsandchannelvalues will modify the same attachments, rather than adding more. Thetsvalue you supply must correspond to a message in the specifiedchannel.source- The source of the link to unfurl. The source may either becomposer, when the link is inside the message composer, orconversations_history, when the link has been posted to a conversation. Acceptable values:composerconversations_history. Bothunfurl_idandsourcemust be provided together, orchannelandtsmust be provided together. The first time this method is executed with a particulartsandchannel(orunfurl_idandsource) combination, the validunfurlsattachments you provide will be attached to the message. ex:composerts- Timestamp of the message to add unfurl behavior to. Required for public channels. Bothunfurl_idandsourcemust be provided together, orchannelandtsmust be provided together. The first time this method is executed with a particulartsandchannel(orunfurl_idandsource) combination, the validunfurlsattachments you provide will be attached to the message. Subsequent attempts with the sametsandchannelvalues will modify the same attachments, rather than adding more. Thetsvalue you supply must correspond to a message in the specifiedchannel.unfurl_id- The ID of the link to unfurl. Bothunfurl_idandsourcemust be provided together, orchannelandtsmust be provided together. Bothunfurl_idandsourcemust be provided together, orchannelandtsmust be provided together. The first time this method is executed with a particulartsandchannel(orunfurl_idandsource) combination, the validunfurlsattachments you provide will be attached to the message. ex:Uxxxxxxx-909b5454-75f8-4ac4-b325-1b40e230bbd8unfurls- 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 particulartsandchannel(orunfurl_idandsource) combination, the validunfurlsattachments 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-baseduser_auth_messagevalue or JSON array of blocks usinguser_auth_blocks. Using both properties shows theuser_auth_messagein a notification and theuser_auth_blocksin 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 noworNever ask me again. Or, you can send an ephemeral message to that user by providing a simple string-baseduser_auth_messagevalue or JSON array of blocks usinguser_auth_blocks. Using both properties shows theuser_auth_messagein a notification and theuser_auth_blocksin the ephemeral message. Specifyinguser_auth_urloruser_auth_messagewill automatically implyuser_auth_requiredbeing set totrue. If bothuser_auth_urlanduser_auth_messageare provided,user_auth_messagetakes precedence.user_auth_required- Set totrueor1to indicate the user must install your Slack app to trigger unfurls for this domain. Specifyinguser_auth_urloruser_auth_messagewill automatically implyuser_auth_requiredbeing set totrue.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. Specifyinguser_auth_urloruser_auth_messagewill automatically implyuser_auth_requiredbeing set totrue. If bothuser_auth_urlanduser_auth_messageare provided,user_auth_messagetakes 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- Thetsvalue 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 providedunfurlsargument 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 alink_sharedevent tied to the same URL. It is also returned when the domain appears in a workspace's administrative blocklists.invalid_metadata_format- Themetadataparameter 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- Theunfurlsparameter cannot be JSON-decoded into a map of URLs to attachments.missing_channel- The request is missing thechannelparametermissing_source- The request is missing thesourceparameter.missing_ts- The request is missing thetsparametermissing_unfurl_id- The request is missing theunfurl_idparameter.missing_unfurls- The request is missing theunfurlsparameter.
See the Common Errors guide for errors returned by every Web API method.
Updates a message.
API reference
Rate limit: Tier 3: 50+ per minute
Scopes:
- Bot token:
chat:write - User token:
chat:write
Required Params
channel- Channel containing the message to be updated. For direct messages, ensure that this value is a DM ID (starts withD) instead of a User ID (starts with eitherUorW).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:trueattachments- A JSON-based array of structured attachments, presented as a URL-encoded string. Similarly, theattachmentsfield is required when not presentingtext. 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 whetherblocksortextis supplied. Slack will always try to render the message usingblocks, and usetextonly for notifications. If you don't includeblocks, the message's previousblockswill only be retained if thetextargument is not provided. If thetextargument is provided andblocksare not provided, theblockswill be removed, and the providedtextwill be used for message rendering. Ifblocksare used and a message is being updated, theeditedflag will not be displayed on the message (the flag will be displayed on the message if usingtext). 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 tonone. 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:truemarkdown_text- Accepts message text formatted in markdown. This argument should not be used in conjunction withblocksortext. 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 previousmetadatawill be retained. To remove previousmetadata, 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 toclient, unlikechat.postMessage. Accepts eithernoneorfull. 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:nonereply_broadcast- Broadcast an existing thread reply to make it visible to everyone in the channel or conversation. ex:truetext- 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 whetherblocksortextis supplied. Slack will always try to render the message usingblocks, and usetextonly for notifications. If you don't includeblocks, the message's previousblockswill only be retained if thetextargument is not provided. If thetextargument is provided andblocksare not provided, theblockswill be removed, and the providedtextwill be used for message rendering. Ifblocksare used and a message is being updated, theeditedflag will not be displayed on the message (the flag will be displayed on the message if usingtext). Similarly, theattachmentsfield is required when not presentingtext. ex:Hello worldunfurled_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 settingsmax_file_sharing_exceeded- Exceeded max allowed files shared.invalid_metadata_format- Invalid metadata format providedslack_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 providedno_text- No message text providedslack_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 tokenfile_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- Theas_userparameter 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- Theblocksarray 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 forchannelwas 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. Thetextfield cannot exceed 4,000 characters.markdown_text_conflict- Markdown text cannot be used in conjunction withblocksortextargument.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 blocksmetadata_too_large- Metadata exceeds size limit
See the Common Errors guide for errors returned by every Web API method.