Slack.Web.Chat (SlackKit v0.25.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.

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
  • token_revoked - Authentication token is for a deleted user or workspace or the app has been removed when using a user token.
  • channel_type_not_supported - Channel type not supported
  • invalid_arg_name - The method was passed an argument whose name falls outside the bounds of accepted or expected values. This includes very long names and names with non-alphanumeric characters other than _. If you get this error, it is typically an indication that you have made a very malformed API call.
  • two_factor_setup_required - Two factor setup is required.
  • 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.
  • invalid_form_data - The method was called via a POST request with Content-Type application/x-www-form-urlencoded or multipart/form-data, but the form data was either missing or syntactically invalid.
  • rate_limited - Application has posted too many messages, read the Rate Limit documentation for more information
  • invalid_post_type - The method was called via a POST request, but the specified Content-Type was invalid. Valid types are: application/json application/x-www-form-urlencoded multipart/form-data text/plain.
  • 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
  • fatal_error - The server could not complete your operation(s) without encountering a catastrophic error. It's possible some aspect of the operation succeeded before the error was raised.
  • no_text - No message text provided
  • deprecated_endpoint - The endpoint has been deprecated.
  • 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
  • ratelimited - The request has been ratelimited. Refer to the Retry-After header for when to retry the request.
  • ekm_access_denied - Your message couldn’t be sent because your admins have disabled sending messages to this channel.
  • service_unavailable - The service is temporarily unavailable
  • 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.
  • team_access_not_granted - The token used is not granted the specific workspace access required to complete this request.
  • msg_blocks_too_many - Max blocks exceeded, blocks are limited to 50 per message.
  • invalid_arguments - The method was called with invalid arguments.
  • 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
  • invalid_array_arg - The method was passed an array as an argument. Please only input valid strings.
  • request_timeout - The method was called via a POST request, but the POST data was either missing or truncated.
  • team_not_found - This error occurs if, when using an org-wide token, the channel_name is passed instead of the channel_id.
  • account_inactive - Authentication token is for a deleted user or workspace when using a bot token.
  • 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.
  • not_authed - No authentication token provided.
  • internal_error - The server could not complete your operation(s) without encountering an error, likely due to a transient issue on our end. It's possible some aspect of the operation succeeded before the error was raised.
  • enterprise_is_restricted - The method cannot be called from an Enterprise.
  • no_permission - The workspace token used in this request does not have the permissions necessary to complete the request. Make sure your app is a member of the conversation it's attempting to post a message to.
  • access_denied - Access to a resource specified in the request is denied.
  • too_many_attachments - Too many attachments were provided with this message. A maximum of 100 attachments are allowed on a message.
  • team_added_to_org - The workspace associated with your request is currently undergoing migration to an Enterprise Organization. Web API and other platform operations will be intermittently unavailable until the transition is complete.
  • message_not_found - Message not found
  • missing_scope - The token used is not granted the specific scope permissions required to complete this request.
  • missing_post_type - The method was called via a POST request and included a data payload, but the request did not include a Content-Type header.
  • accesslimited - Access to this method is limited on the current network
  • token_expired - Authentication token has expired
  • message_not_in_streaming_state - The message is not in the streaming state.
  • invalid_charset - The method was called via a POST request, but the charset specified in the Content-Type header was invalid. Valid charset names are: utf-8 iso-8859-1.
  • is_archived - Channel has been archived.
  • method_deprecated - The method has been deprecated.
  • 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.
  • not_allowed_token_type - The token type used in this request is not allowed.
  • org_login_required - The workspace is undergoing an enterprise migration and will not be available until migration is complete.
  • restricted_action_non_threadable_channel - Cannot post thread replies into a non_threadable channel.
  • invalid_auth - Some aspect of authentication cannot be validated. Either the provided token is invalid or the request originates from an IP address disallowed from making the request.
  • 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

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

Deletes a message.

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.
  • token_revoked - Authentication token is for a deleted user or workspace or the app has been removed when using a user token.
  • invalid_arg_name - The method was passed an argument whose name falls outside the bounds of accepted or expected values. This includes very long names and names with non-alphanumeric characters other than _. If you get this error, it is typically an indication that you have made a very malformed API call.
  • two_factor_setup_required - Two factor setup is required.
  • invalid_form_data - The method was called via a POST request with Content-Type application/x-www-form-urlencoded or multipart/form-data, but the form data was either missing or syntactically invalid.
  • invalid_post_type - The method was called via a POST request, but the specified Content-Type was invalid. Valid types are: application/json application/x-www-form-urlencoded multipart/form-data text/plain.
  • fatal_error - The server could not complete your operation(s) without encountering a catastrophic error. It's possible some aspect of the operation succeeded before the error was raised.
  • deprecated_endpoint - The endpoint has been deprecated.
  • ratelimited - The request has been ratelimited. Refer to the Retry-After header for when to retry the request.
  • ekm_access_denied - Administrators have suspended the ability to post a message.
  • service_unavailable - The service is temporarily unavailable
  • team_access_not_granted - The token used is not granted the specific workspace access required to complete this request.
  • invalid_arguments - The method was called with invalid arguments.
  • invalid_array_arg - The method was passed an array as an argument. Please only input valid strings.
  • request_timeout - The method was called via a POST request, but the POST data was either missing or truncated.
  • account_inactive - Authentication token is for a deleted user or workspace when using a bot token.
  • channel_not_found - Value passed for channel was invalid.
  • not_authed - No authentication token provided.
  • internal_error - The server could not complete your operation(s) without encountering an error, likely due to a transient issue on our end. It's possible some aspect of the operation succeeded before the error was raised.
  • enterprise_is_restricted - The method cannot be called from an Enterprise.
  • no_permission - The workspace token used in this request does not have the permissions necessary to complete the request. Make sure your app is a member of the conversation it's attempting to post a message to.
  • access_denied - Access to a resource specified in the request is denied.
  • team_added_to_org - The workspace associated with your request is currently undergoing migration to an Enterprise Organization. Web API and other platform operations will be intermittently unavailable until the transition is complete.
  • message_not_found - No message exists with the requested timestamp.
  • missing_scope - The token used is not granted the specific scope permissions required to complete this request.
  • missing_post_type - The method was called via a POST request and included a data payload, but the request did not include a Content-Type header.
  • accesslimited - Access to this method is limited on the current network
  • token_expired - Authentication token has expired
  • invalid_charset - The method was called via a POST request, but the charset specified in the Content-Type header was invalid. Valid charset names are: utf-8 iso-8859-1.
  • method_deprecated - The method has been deprecated.
  • not_allowed_token_type - The token type used in this request is not allowed.
  • org_login_required - The workspace is undergoing an enterprise migration and will not be available until migration is complete.
  • invalid_auth - Some aspect of authentication cannot be validated. Either the provided token is invalid or the request originates from an IP address disallowed from making the request.

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

Deletes a pending scheduled message from the queue.

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.
  • token_revoked - Authentication token is for a deleted user or workspace or the app has been removed when using a user token.
  • invalid_arg_name - The method was passed an argument whose name falls outside the bounds of accepted or expected values. This includes very long names and names with non-alphanumeric characters other than _. If you get this error, it is typically an indication that you have made a very malformed API call.
  • two_factor_setup_required - Two factor setup is required.
  • invalid_form_data - The method was called via a POST request with Content-Type application/x-www-form-urlencoded or multipart/form-data, but the form data was either missing or syntactically invalid.
  • invalid_post_type - The method was called via a POST request, but the specified Content-Type was invalid. Valid types are: application/json application/x-www-form-urlencoded multipart/form-data text/plain.
  • fatal_error - The server could not complete your operation(s) without encountering a catastrophic error. It's possible some aspect of the operation succeeded before the error was raised.
  • deprecated_endpoint - The endpoint has been deprecated.
  • ratelimited - The request has been ratelimited. Refer to the Retry-After header for when to retry the request.
  • ekm_access_denied - Administrators have suspended the ability to post a message.
  • service_unavailable - The service is temporarily unavailable
  • team_access_not_granted - The token used is not granted the specific workspace access required to complete this request.
  • invalid_arguments - The method was called with invalid arguments.
  • invalid_array_arg - The method was passed an array as an argument. Please only input valid strings.
  • 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.
  • request_timeout - The method was called via a POST request, but the POST data was either missing or truncated.
  • account_inactive - Authentication token is for a deleted user or workspace when using a bot token.
  • channel_not_found - The channel passed is either an invalid ID or does not exist.
  • not_authed - No authentication token provided.
  • internal_error - The server could not complete your operation(s) without encountering an error, likely due to a transient issue on our end. It's possible some aspect of the operation succeeded before the error was raised.
  • enterprise_is_restricted - The method cannot be called from an Enterprise.
  • no_permission - The workspace token used in this request does not have the permissions necessary to complete the request. Make sure your app is a member of the conversation it's attempting to post a message to.
  • access_denied - Access to a resource specified in the request is denied.
  • team_added_to_org - The workspace associated with your request is currently undergoing migration to an Enterprise Organization. Web API and other platform operations will be intermittently unavailable until the transition is complete.
  • missing_scope - The token used is not granted the specific scope permissions required to complete this request.
  • missing_post_type - The method was called via a POST request and included a data payload, but the request did not include a Content-Type header.
  • accesslimited - Access to this method is limited on the current network
  • token_expired - Authentication token has expired
  • invalid_charset - The method was called via a POST request, but the charset specified in the Content-Type header was invalid. Valid charset names are: utf-8 iso-8859-1.
  • method_deprecated - The method has been deprecated.
  • not_allowed_token_type - The token type used in this request is not allowed.
  • org_login_required - The workspace is undergoing an enterprise migration and will not be available until migration is complete.
  • invalid_auth - Some aspect of authentication cannot be validated. Either the provided token is invalid or the request originates from an IP address disallowed from making the request.

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

Retrieve a permalink URL for a specific extant message

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:

  • access_denied - Access to a resource specified in the request is denied.
  • accesslimited - Access to this method is limited on the current network
  • account_inactive - Authentication token is for a deleted user or workspace when using a bot token.
  • channel_not_found - Value passed for channel was invalid.
  • deprecated_endpoint - The endpoint has been deprecated.
  • ekm_access_denied - Administrators have suspended the ability to post a message.
  • enterprise_is_restricted - The method cannot be called from an Enterprise.
  • fatal_error - The server could not complete your operation(s) without encountering a catastrophic error. It's possible some aspect of the operation succeeded before the error was raised.
  • internal_error - The server could not complete your operation(s) without encountering an error, likely due to a transient issue on our end. It's possible some aspect of the operation succeeded before the error was raised.
  • invalid_arg_name - The method was passed an argument whose name falls outside the bounds of accepted or expected values. This includes very long names and names with non-alphanumeric characters other than _. If you get this error, it is typically an indication that you have made a very malformed API call.
  • invalid_arguments - The method was called with invalid arguments.
  • invalid_array_arg - The method was passed an array as an argument. Please only input valid strings.
  • invalid_auth - Some aspect of authentication cannot be validated. Either the provided token is invalid or the request originates from an IP address disallowed from making the request.
  • invalid_charset - The method was called via a POST request, but the charset specified in the Content-Type header was invalid. Valid charset names are: utf-8 iso-8859-1.
  • invalid_form_data - The method was called via a POST request with Content-Type application/x-www-form-urlencoded or multipart/form-data, but the form data was either missing or syntactically invalid.
  • invalid_post_type - The method was called via a POST request, but the specified Content-Type was invalid. Valid types are: application/json application/x-www-form-urlencoded multipart/form-data text/plain.
  • message_not_found - The message identified by message_ts could not be found.
  • method_deprecated - The method has been deprecated.
  • missing_post_type - The method was called via a POST request and included a data payload, but the request did not include a Content-Type header.
  • missing_scope - The token used is not granted the specific scope permissions required to complete this request.
  • no_permission - The workspace token used in this request does not have the permissions necessary to complete the request. Make sure your app is a member of the conversation it's attempting to post a message to.
  • not_allowed_token_type - The token type used in this request is not allowed.
  • not_authed - No authentication token provided.
  • org_login_required - The workspace is undergoing an enterprise migration and will not be available until migration is complete.
  • ratelimited - The request has been ratelimited. Refer to the Retry-After header for when to retry the request.
  • request_timeout - The method was called via a POST request, but the POST data was either missing or truncated.
  • service_unavailable - The service is temporarily unavailable
  • team_access_not_granted - The token used is not granted the specific workspace access required to complete this request.
  • team_added_to_org - The workspace associated with your request is currently undergoing migration to an Enterprise Organization. Web API and other platform operations will be intermittently unavailable until the transition is complete.
  • token_expired - Authentication token has expired
  • token_revoked - Authentication token is for a deleted user or workspace or the app has been removed when using a user token.
  • two_factor_setup_required - Two factor setup is required.

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

Share a me message into a channel.

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:

  • token_revoked - Authentication token is for a deleted user or workspace or the app has been removed when using a user token.
  • invalid_arg_name - The method was passed an argument whose name falls outside the bounds of accepted or expected values. This includes very long names and names with non-alphanumeric characters other than _. If you get this error, it is typically an indication that you have made a very malformed API call.
  • two_factor_setup_required - Two factor setup is required.
  • invalid_form_data - The method was called via a POST request with Content-Type application/x-www-form-urlencoded or multipart/form-data, but the form data was either missing or syntactically invalid.
  • rate_limited - Application has posted too many messages, read the Rate Limit documentation for more information
  • invalid_post_type - The method was called via a POST request, but the specified Content-Type was invalid. Valid types are: application/json application/x-www-form-urlencoded multipart/form-data text/plain.
  • fatal_error - The server could not complete your operation(s) without encountering a catastrophic error. It's possible some aspect of the operation succeeded before the error was raised.
  • no_text - No message text provided
  • deprecated_endpoint - The endpoint has been deprecated.
  • ratelimited - The request has been ratelimited. Refer to the Retry-After header for when to retry the request.
  • ekm_access_denied - Administrators have suspended the ability to post a message.
  • service_unavailable - The service is temporarily unavailable
  • not_in_channel - Cannot post user messages to a channel they are not in.
  • team_access_not_granted - The token used is not granted the specific workspace access required to complete this request.
  • invalid_arguments - The method was called with invalid arguments.
  • invalid_array_arg - The method was passed an array as an argument. Please only input valid strings.
  • request_timeout - The method was called via a POST request, but the POST data was either missing or truncated.
  • account_inactive - Authentication token is for a deleted user or workspace when using a bot token.
  • channel_not_found - Value passed for channel was invalid.
  • not_authed - No authentication token provided.
  • internal_error - The server could not complete your operation(s) without encountering an error, likely due to a transient issue on our end. It's possible some aspect of the operation succeeded before the error was raised.
  • enterprise_is_restricted - The method cannot be called from an Enterprise.
  • no_permission - The workspace token used in this request does not have the permissions necessary to complete the request. Make sure your app is a member of the conversation it's attempting to post a message to.
  • access_denied - Access to a resource specified in the request is denied.
  • team_added_to_org - The workspace associated with your request is currently undergoing migration to an Enterprise Organization. Web API and other platform operations will be intermittently unavailable until the transition is complete.
  • missing_scope - The token used is not granted the specific scope permissions required to complete this request.
  • missing_post_type - The method was called via a POST request and included a data payload, but the request did not include a Content-Type header.
  • accesslimited - Access to this method is limited on the current network
  • msg_too_long - Message text is too long
  • token_expired - Authentication token has expired
  • invalid_charset - The method was called via a POST request, but the charset specified in the Content-Type header was invalid. Valid charset names are: utf-8 iso-8859-1.
  • is_archived - Channel has been archived.
  • method_deprecated - The method has been deprecated.
  • not_allowed_token_type - The token type used in this request is not allowed.
  • org_login_required - The workspace is undergoing an enterprise migration and will not be available until migration is complete.
  • invalid_auth - Some aspect of authentication cannot be validated. Either the provided token is invalid or the request originates from an IP address disallowed from making the request.

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

Sends an ephemeral message to a user in a channel.

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:

  • token_revoked - Authentication token is for a deleted user or workspace or the app has been removed when using a user token.
  • invalid_arg_name - The method was passed an argument whose name falls outside the bounds of accepted or expected values. This includes very long names and names with non-alphanumeric characters other than _. If you get this error, it is typically an indication that you have made a very malformed API call.
  • two_factor_setup_required - Two factor setup is required.
  • invalid_form_data - The method was called via a POST request with Content-Type application/x-www-form-urlencoded or multipart/form-data, but the form data was either missing or syntactically invalid.
  • invalid_post_type - The method was called via a POST request, but the specified Content-Type was invalid. Valid types are: application/json application/x-www-form-urlencoded multipart/form-data text/plain.
  • invalid_blocks - Blocks submitted with this message are not valid
  • restricted_action - A workspace preference prevents the authenticated user from posting.
  • fatal_error - The server could not complete your operation(s) without encountering a catastrophic error. It's possible some aspect of the operation succeeded before the error was raised.
  • no_text - No message text provided
  • cannot_reply_to_message - This message type cannot have thread replies.
  • invalid_attachments - Attachments that contain blocks are not valid
  • deprecated_endpoint - The endpoint has been deprecated.
  • ratelimited - The request has been ratelimited. Refer to the Retry-After header for when to retry the request.
  • ekm_access_denied - Administrators have suspended the ability to post a message.
  • service_unavailable - The service is temporarily unavailable
  • messages_tab_disabled - Messages tab for the app is disabled.
  • not_in_channel - Cannot post user messages to a channel they are not in.
  • team_access_not_granted - The token used is not granted the specific workspace access required to complete this request.
  • user_not_in_channel - Intended recipient is not in the specified channel.
  • invalid_arguments - The method was called with invalid arguments.
  • 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
  • invalid_array_arg - The method was passed an array as an argument. Please only input valid strings.
  • request_timeout - The method was called via a POST request, but the POST data was either missing or truncated.
  • account_inactive - Authentication token is for a deleted user or workspace when using a bot token.
  • invalid_blocks_format - The blocks is not a valid JSON object or doesn't match the Block Kit syntax.
  • channel_not_found - Value passed for channel was invalid.
  • not_authed - No authentication token provided.
  • internal_error - The server could not complete your operation(s) without encountering an error, likely due to a transient issue on our end. It's possible some aspect of the operation succeeded before the error was raised.
  • enterprise_is_restricted - The method cannot be called from an Enterprise.
  • no_permission - The workspace token used in this request does not have the permissions necessary to complete the request. Make sure your app is a member of the conversation it's attempting to post a message to.
  • access_denied - Access to a resource specified in the request is denied.
  • too_many_attachments - Too many attachments were provided with this message. A maximum of 100 attachments are allowed on a message.
  • team_added_to_org - The workspace associated with your request is currently undergoing migration to an Enterprise Organization. Web API and other platform operations will be intermittently unavailable until the transition is complete.
  • missing_scope - The token used is not granted the specific scope permissions required to complete this request.
  • missing_post_type - The method was called via a POST request and included a data payload, but the request did not include a Content-Type header.
  • accesslimited - Access to this method is limited on the current network
  • msg_too_long - Message text is too long
  • markdown_text_conflict - Markdown text cannot be used in conjunction with blocks or text argument.
  • token_expired - Authentication token has expired
  • invalid_charset - The method was called via a POST request, but the charset specified in the Content-Type header was invalid. Valid charset names are: utf-8 iso-8859-1.
  • is_archived - Channel has been archived.
  • method_deprecated - The method has been deprecated.
  • not_allowed_token_type - The token type used in this request is not allowed.
  • org_login_required - The workspace is undergoing an enterprise migration and will not be available until migration is complete.
  • invalid_auth - Some aspect of authentication cannot be validated. Either the provided token is invalid or the request originates from an IP address disallowed from making the request.

post_message(channel, optional_params \\ %{})

Sends a message to a channel.

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.
  • token_revoked - Authentication token is for a deleted user or workspace or the app has been removed when using a user token.
  • invalid_arg_name - The method was passed an argument whose name falls outside the bounds of accepted or expected values. This includes very long names and names with non-alphanumeric characters other than _. If you get this error, it is typically an indication that you have made a very malformed API call.
  • two_factor_setup_required - Two factor setup is required.
  • draft_already_sent - The draft has already been sent.
  • invalid_form_data - The method was called via a POST request with Content-Type application/x-www-form-urlencoded or multipart/form-data, but the form data was either missing or syntactically invalid.
  • rate_limited - Application has posted too many messages, read the Rate Limit documentation for more information.
  • invalid_post_type - The method was called via a POST request, but the specified Content-Type was invalid. Valid types are: application/json application/x-www-form-urlencoded multipart/form-data text/plain.
  • 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.
  • fatal_error - The server could not complete your operation(s) without encountering a catastrophic error. It's possible some aspect of the operation succeeded before the error was raised.
  • no_text - No message text provided.
  • cannot_reply_to_message - This message type cannot have thread replies.
  • deprecated_endpoint - The endpoint has been deprecated.
  • 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.
  • ratelimited - The request has been ratelimited. Refer to the Retry-After header for when to retry the request.
  • ekm_access_denied - Your message couldn’t be sent because your admins have disabled sending messages to this channel.
  • service_unavailable - The service is temporarily unavailable
  • 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.
  • team_access_not_granted - The token used is not granted the specific workspace access required to complete this request.
  • draft_already_deleted - The draft has already been deleted.
  • invalid_arguments - The method was called with invalid arguments.
  • 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.
  • invalid_array_arg - The method was passed an array as an argument. Please only input valid strings.
  • request_timeout - The method was called via a POST request, but the POST data was either missing or truncated.
  • team_not_found - This error occurs if, when using an org-wide token, the channel_name is passed instead of the channel_id.
  • account_inactive - Authentication token is for a deleted user or workspace when using a bot token.
  • 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.
  • not_authed - No authentication token provided.
  • internal_error - The server could not complete your operation(s) without encountering an error, likely due to a transient issue on our end. It's possible some aspect of the operation succeeded before the error was raised.
  • enterprise_is_restricted - The method cannot be called from an Enterprise.
  • no_permission - The workspace token used in this request does not have the permissions necessary to complete the request. Make sure your app is a member of the conversation it's attempting to post a message to.
  • access_denied - Access to a resource specified in the request is denied.
  • too_many_attachments - Too many attachments were provided with this message. A maximum of 100 attachments are allowed on a message.
  • team_added_to_org - The workspace associated with your request is currently undergoing migration to an Enterprise Organization. Web API and other platform operations will be intermittently unavailable until the transition is complete.
  • missing_scope - The token used is not granted the specific scope permissions required to complete this request.
  • missing_post_type - The method was called via a POST request and included a data payload, but the request did not include a Content-Type header.
  • accesslimited - Access to this method is limited on the current network
  • markdown_text_conflict - Markdown text cannot be used in conjunction with blocks or text argument.
  • token_expired - Authentication token has expired
  • attachment_payload_limit_exceeded - Attachment payload size is too long.
  • invalid_charset - The method was called via a POST request, but the charset specified in the Content-Type header was invalid. Valid charset names are: utf-8 iso-8859-1.
  • is_archived - Channel has been archived.
  • method_deprecated - The method has been deprecated.
  • 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.
  • not_allowed_token_type - The token type used in this request is not allowed.
  • org_login_required - The workspace is undergoing an enterprise migration and will not be available until migration is complete.
  • 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.
  • invalid_auth - Some aspect of authentication cannot be validated. Either the provided token is invalid or the request originates from an IP address disallowed from making the request.
  • restricted_action_thread_only_channel - Cannot post top-level messages into a thread-only channel.
  • metadata_too_large - Metadata exceeds size limit.

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

Schedules a message to be sent to a channel.

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:

  • invalid_time - value passed for post_time was invalid.
  • time_too_far - value passed for post_time was too far into the future.
  • invalid_metadata_format - Invalid metadata format provided
  • token_revoked - Authentication token is for a deleted user or workspace or the app has been removed when using a user token.
  • invalid_arg_name - The method was passed an argument whose name falls outside the bounds of accepted or expected values. This includes very long names and names with non-alphanumeric characters other than _. If you get this error, it is typically an indication that you have made a very malformed API call.
  • two_factor_setup_required - Two factor setup is required.
  • invalid_form_data - The method was called via a POST request with Content-Type application/x-www-form-urlencoded or multipart/form-data, but the form data was either missing or syntactically invalid.
  • rate_limited - Application has posted too many messages, read the Rate Limit documentation for more information
  • invalid_post_type - The method was called via a POST request, but the specified Content-Type was invalid. Valid types are: application/json application/x-www-form-urlencoded multipart/form-data text/plain.
  • 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
  • fatal_error - The server could not complete your operation(s) without encountering a catastrophic error. It's possible some aspect of the operation succeeded before the error was raised.
  • restricted_too_many - Too many messages were scheduled in the channel for a given period. See usage info for additional details
  • no_text - No message text provided
  • deprecated_endpoint - The endpoint has been deprecated.
  • 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
  • ratelimited - The request has been ratelimited. Refer to the Retry-After header for when to retry the request.
  • ekm_access_denied - Administrators have suspended the ability to post a message.
  • service_unavailable - The service is temporarily unavailable
  • not_in_channel - Cannot post user messages to a channel they are not in.
  • team_access_not_granted - The token used is not granted the specific workspace access required to complete this request.
  • invalid_arguments - The method was called with invalid arguments.
  • 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
  • invalid_array_arg - The method was passed an array as an argument. Please only input valid strings.
  • request_timeout - The method was called via a POST request, but the POST data was either missing or truncated.
  • account_inactive - Authentication token is for a deleted user or workspace when using a bot token.
  • invalid_blocks_format - The blocks is not a valid JSON object or doesn't match the Block Kit syntax.
  • channel_not_found - Value passed for channel was invalid.
  • not_authed - No authentication token provided.
  • internal_error - The server could not complete your operation(s) without encountering an error, likely due to a transient issue on our end. It's possible some aspect of the operation succeeded before the error was raised.
  • enterprise_is_restricted - The method cannot be called from an Enterprise.
  • no_permission - The workspace token used in this request does not have the permissions necessary to complete the request. Make sure your app is a member of the conversation it's attempting to post a message to.
  • access_denied - Access to a resource specified in the request is denied.
  • too_many_attachments - Too many attachments were provided with this message. A maximum of 100 attachments are allowed on a message.
  • team_added_to_org - The workspace associated with your request is currently undergoing migration to an Enterprise Organization. Web API and other platform operations will be intermittently unavailable until the transition is complete.
  • missing_scope - The token used is not granted the specific scope permissions required to complete this request.
  • missing_post_type - The method was called via a POST request and included a data payload, but the request did not include a Content-Type header.
  • accesslimited - Access to this method is limited on the current network
  • msg_too_long - Message text is too long
  • invalid_token - The passed token is invalid or not supported by this method.
  • markdown_text_conflict - Markdown text cannot be used in conjunction with blocks or text argument.
  • token_expired - Authentication token has expired
  • invalid_charset - The method was called via a POST request, but the charset specified in the Content-Type header was invalid. Valid charset names are: utf-8 iso-8859-1.
  • is_archived - Channel has been archived.
  • method_deprecated - The method has been deprecated.
  • not_allowed_token_type - The token type used in this request is not allowed.
  • org_login_required - The workspace is undergoing an enterprise migration and will not be available until migration is complete.
  • restricted_action_non_threadable_channel - Cannot post thread replies into a non_threadable channel.
  • invalid_auth - Some aspect of authentication cannot be validated. Either the provided token is invalid or the request originates from an IP address disallowed from making the request.
  • time_in_past - value passed for post_time was in the past.
  • restricted_action_thread_only_channel - Cannot post top-level messages into a thread-only channel.
  • metadata_too_large - Metadata exceeds size limit

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

Starts a new streaming conversation.

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:

  • invalid_metadata_format - Invalid metadata format provided
  • token_revoked - Authentication token is for a deleted user or workspace or the app has been removed when using a user token.
  • channel_type_not_supported - Channel type not supported
  • invalid_arg_name - The method was passed an argument whose name falls outside the bounds of accepted or expected values. This includes very long names and names with non-alphanumeric characters other than _. If you get this error, it is typically an indication that you have made a very malformed API call.
  • missing_recipient_team_id - Missing recipient team ID.
  • two_factor_setup_required - Two factor setup is required.
  • invalid_chunks - Chunks submitted with this message are not valid.
  • invalid_form_data - The method was called via a POST request with Content-Type application/x-www-form-urlencoded or multipart/form-data, but the form data was either missing or syntactically invalid.
  • rate_limited - Application has posted too many messages, read the Rate Limit documentation for more information
  • invalid_post_type - The method was called via a POST request, but the specified Content-Type was invalid. Valid types are: application/json application/x-www-form-urlencoded multipart/form-data text/plain.
  • 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
  • fatal_error - The server could not complete your operation(s) without encountering a catastrophic error. It's possible some aspect of the operation succeeded before the error was raised.
  • no_text - No message text provided
  • deprecated_endpoint - The endpoint has been deprecated.
  • 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
  • ratelimited - The request has been ratelimited. Refer to the Retry-After header for when to retry the request.
  • ekm_access_denied - Your message couldn’t be sent because your admins have disabled sending messages to this channel.
  • service_unavailable - The service is temporarily unavailable
  • messages_tab_disabled - Messages tab for the app is disabled.
  • not_in_channel - Cannot post user messages to a channel they are not in.
  • user_not_found - User not found.
  • team_access_not_granted - The token used is not granted the specific workspace access required to complete this request.
  • msg_blocks_too_many - Max blocks exceeded, blocks are limited to 50 per message.
  • invalid_arguments - The method was called with invalid arguments.
  • 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
  • invalid_array_arg - The method was passed an array as an argument. Please only input valid strings.
  • request_timeout - The method was called via a POST request, but the POST data was either missing or truncated.
  • team_not_found - This error occurs if, when using an org-wide token, the channel_name is passed instead of the channel_id.
  • account_inactive - Authentication token is for a deleted user or workspace when using a bot token.
  • 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.
  • not_authed - No authentication token provided.
  • internal_error - The server could not complete your operation(s) without encountering an error, likely due to a transient issue on our end. It's possible some aspect of the operation succeeded before the error was raised.
  • enterprise_is_restricted - The method cannot be called from an Enterprise.
  • no_permission - The workspace token used in this request does not have the permissions necessary to complete the request. Make sure your app is a member of the conversation it's attempting to post a message to.
  • access_denied - Access to a resource specified in the request is denied.
  • team_added_to_org - The workspace associated with your request is currently undergoing migration to an Enterprise Organization. Web API and other platform operations will be intermittently unavailable until the transition is complete.
  • missing_scope - The token used is not granted the specific scope permissions required to complete this request.
  • missing_post_type - The method was called via a POST request and included a data payload, but the request did not include a Content-Type header.
  • accesslimited - Access to this method is limited on the current network
  • token_expired - Authentication token has expired
  • invalid_charset - The method was called via a POST request, but the charset specified in the Content-Type header was invalid. Valid charset names are: utf-8 iso-8859-1.
  • is_archived - Channel has been archived.
  • method_deprecated - The method has been deprecated.
  • duplicate_channel_not_found - Channel associated with client_msg_id was invalid.
  • missing_recipient_user_id - Missing recipient user ID.
  • restricted_action_thread_locked - Cannot post replies to a thread that has been locked by admins.
  • not_allowed_token_type - The token type used in this request is not allowed.
  • org_login_required - The workspace is undergoing an enterprise migration and will not be available until migration is complete.
  • restricted_action_non_threadable_channel - Cannot post thread replies into a non_threadable channel.
  • invalid_auth - Some aspect of authentication cannot be validated. Either the provided token is invalid or the request originates from an IP address disallowed from making the request.
  • 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

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

Stops a streaming conversation.

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
  • token_revoked - Authentication token is for a deleted user or workspace or the app has been removed when using a user token.
  • channel_type_not_supported - Channel type not supported.
  • invalid_arg_name - The method was passed an argument whose name falls outside the bounds of accepted or expected values. This includes very long names and names with non-alphanumeric characters other than _. If you get this error, it is typically an indication that you have made a very malformed API call.
  • two_factor_setup_required - Two factor setup is required.
  • invalid_chunks - Chunks submitted with this message are not valid.
  • invalid_form_data - The method was called via a POST request with Content-Type application/x-www-form-urlencoded or multipart/form-data, but the form data was either missing or syntactically invalid.
  • rate_limited - Application has posted too many messages, read the Rate Limit documentation for more information
  • invalid_post_type - The method was called via a POST request, but the specified Content-Type was invalid. Valid types are: application/json application/x-www-form-urlencoded multipart/form-data text/plain.
  • 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
  • fatal_error - The server could not complete your operation(s) without encountering a catastrophic error. It's possible some aspect of the operation succeeded before the error was raised.
  • no_text - No message text provided
  • cannot_reply_to_message - This message type cannot have thread replies.
  • deprecated_endpoint - The endpoint has been deprecated.
  • 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
  • ratelimited - The request has been ratelimited. Refer to the Retry-After header for when to retry the request.
  • ekm_access_denied - Your message couldn’t be sent because your admins have disabled sending messages to this channel.
  • service_unavailable - The service is temporarily unavailable
  • 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.
  • team_access_not_granted - The token used is not granted the specific workspace access required to complete this request.
  • msg_blocks_too_many - Max blocks exceeded, blocks are limited to 50 per message.
  • invalid_arguments - The method was called with invalid arguments.
  • 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
  • invalid_array_arg - The method was passed an array as an argument. Please only input valid strings.
  • request_timeout - The method was called via a POST request, but the POST data was either missing or truncated.
  • team_not_found - This error occurs if, when using an org-wide token, the channel_name is passed instead of the channel_id.
  • account_inactive - Authentication token is for a deleted user or workspace when using a bot token.
  • 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.
  • not_authed - No authentication token provided.
  • internal_error - The server could not complete your operation(s) without encountering an error, likely due to a transient issue on our end. It's possible some aspect of the operation succeeded before the error was raised.
  • enterprise_is_restricted - The method cannot be called from an Enterprise.
  • no_permission - The workspace token used in this request does not have the permissions necessary to complete the request. Make sure your app is a member of the conversation it's attempting to post a message to.
  • access_denied - Access to a resource specified in the request is denied.
  • too_many_attachments - Too many attachments were provided with this message. A maximum of 100 attachments are allowed on a message.
  • team_added_to_org - The workspace associated with your request is currently undergoing migration to an Enterprise Organization. Web API and other platform operations will be intermittently unavailable until the transition is complete.
  • message_not_found - The message was not found.
  • missing_scope - The token used is not granted the specific scope permissions required to complete this request.
  • missing_post_type - The method was called via a POST request and included a data payload, but the request did not include a Content-Type header.
  • accesslimited - Access to this method is limited on the current network
  • token_expired - Authentication token has expired
  • attachment_payload_limit_exceeded - Attachment payload size is too long.
  • message_not_in_streaming_state - The message is not in a streaming state.
  • invalid_charset - The method was called via a POST request, but the charset specified in the Content-Type header was invalid. Valid charset names are: utf-8 iso-8859-1.
  • is_archived - Channel has been archived.
  • method_deprecated - The method has been deprecated.
  • 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.
  • not_allowed_token_type - The token type used in this request is not allowed.
  • org_login_required - The workspace is undergoing an enterprise migration and will not be available until migration is complete.
  • 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.
  • invalid_auth - Some aspect of authentication cannot be validated. Either the provided token is invalid or the request originates from an IP address disallowed from making the request.
  • restricted_action_thread_only_channel - Cannot post top-level messages into a thread-only channel.
  • metadata_too_large - Metadata exceeds size limit

unfurl(optional_params \\ %{})

Provide custom unfurl behavior for user-posted URLs

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:

  • invalid_metadata_format - The metadata parameter cannot be JSON-decoded into the expected format.
  • cannot_find_message - The ts value in the request does not match a message.
  • token_revoked - Authentication token is for a deleted user or workspace or the app has been removed when using a user token.
  • missing_ts - The request is missing the ts parameter
  • invalid_arg_name - The method was passed an argument whose name falls outside the bounds of accepted or expected values. This includes very long names and names with non-alphanumeric characters other than _. If you get this error, it is typically an indication that you have made a very malformed API call.
  • two_factor_setup_required - Two factor setup is required.
  • invalid_unfurl_id - The unfurl ID is invalid.
  • invalid_form_data - The method was called via a POST request with Content-Type application/x-www-form-urlencoded or multipart/form-data, but the form data was either missing or syntactically invalid.
  • invalid_post_type - The method was called via a POST request, but the specified Content-Type was invalid. Valid types are: application/json application/x-www-form-urlencoded multipart/form-data text/plain.
  • cannot_find_service - A record of your app being allowed to unfurl for this workspace could not be found.
  • fatal_error - The server could not complete your operation(s) without encountering a catastrophic error. It's possible some aspect of the operation succeeded before the error was raised.
  • deprecated_endpoint - The endpoint has been deprecated.
  • cannot_find_channel - The specified channel could not be located for this token.
  • ratelimited - The request has been ratelimited. Refer to the Retry-After header for when to retry the request.
  • ekm_access_denied - Administrators have suspended the ability to post a message.
  • service_unavailable - The service is temporarily unavailable
  • team_access_not_granted - The token used is not granted the specific workspace access required to complete this request.
  • invalid_arguments - The method was called with invalid arguments.
  • invalid_array_arg - The method was passed an array as an argument. Please only input valid strings.
  • request_timeout - The method was called via a POST request, but the POST data was either missing or truncated.
  • account_inactive - Authentication token is for a deleted user or workspace when using a bot token.
  • not_authed - No authentication token provided.
  • internal_error - The server could not complete your operation(s) without encountering an error, likely due to a transient issue on our end. It's possible some aspect of the operation succeeded before the error was raised.
  • enterprise_is_restricted - The method cannot be called from an Enterprise.
  • no_permission - The workspace token used in this request does not have the permissions necessary to complete the request. Make sure your app is a member of the conversation it's attempting to post a message to.
  • access_denied - Access to a resource specified in the request is denied.
  • invalid_unfurls_format - The unfurls parameter cannot be JSON-decoded into a map of URLs to attachments.
  • team_added_to_org - The workspace associated with your request is currently undergoing migration to an Enterprise Organization. Web API and other platform operations will be intermittently unavailable until the transition is complete.
  • missing_scope - The token used is not granted the specific scope permissions required to complete this request.
  • missing_post_type - The method was called via a POST request and included a data payload, but the request did not include a Content-Type header.
  • accesslimited - Access to this method is limited on the current network
  • 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.
  • missing_source - The request is missing the source parameter.
  • token_expired - Authentication token has expired
  • missing_unfurls - The request is missing the unfurls parameter.
  • cannot_unfurl_message - The URL cannot be unfurled because the URL provided does not appear in the message.
  • cannot_auth_user - The current user cannot be authenticated.
  • invalid_charset - The method was called via a POST request, but the charset specified in the Content-Type header was invalid. Valid charset names are: utf-8 iso-8859-1.
  • missing_unfurl_id - The request is missing the unfurl_id parameter.
  • method_deprecated - The method has been deprecated.
  • cannot_parse_attachment - The provided unfurls argument could not be parsed or understood.
  • not_allowed_token_type - The token type used in this request is not allowed.
  • org_login_required - The workspace is undergoing an enterprise migration and will not be available until migration is complete.
  • cannot_prompt - The current user has already interacted with and dismissed a prompt for this application.
  • invalid_auth - Some aspect of authentication cannot be validated. Either the provided token is invalid or the request originates from an IP address disallowed from making the request.
  • invalid_source - The unfurl source is invalid.
  • missing_channel - The request is missing the channel parameter

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

Updates a message.

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
  • token_revoked - Authentication token is for a deleted user or workspace or the app has been removed when using a user token.
  • invalid_arg_name - The method was passed an argument whose name falls outside the bounds of accepted or expected values. This includes very long names and names with non-alphanumeric characters other than _. If you get this error, it is typically an indication that you have made a very malformed API call.
  • two_factor_setup_required - Two factor setup is required.
  • invalid_form_data - The method was called via a POST request with Content-Type application/x-www-form-urlencoded or multipart/form-data, but the form data was either missing or syntactically invalid.
  • invalid_post_type - The method was called via a POST request, but the specified Content-Type was invalid. Valid types are: application/json application/x-www-form-urlencoded multipart/form-data text/plain.
  • 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
  • fatal_error - The server could not complete your operation(s) without encountering a catastrophic error. It's possible some aspect of the operation succeeded before the error was raised.
  • 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.
  • deprecated_endpoint - The endpoint has been deprecated.
  • 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.
  • ratelimited - The request has been ratelimited. Refer to the Retry-After header for when to retry the request.
  • ekm_access_denied - Administrators have suspended the ability to post a message.
  • service_unavailable - The service is temporarily unavailable
  • 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.
  • team_access_not_granted - The token used is not granted the specific workspace access required to complete this request.
  • update_failed - Internal update failure.
  • no_dual_broadcast_content_update - Can't broadcast an old reply and update the content at the same time.
  • invalid_arguments - The method was called with invalid arguments.
  • 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.
  • invalid_array_arg - The method was passed an array as an argument. Please only input valid strings.
  • request_timeout - The method was called via a POST request, but the POST data was either missing or truncated.
  • team_not_found - Team associated with the message and channel could not be found.
  • account_inactive - Authentication token is for a deleted user or workspace when using a bot token.
  • 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.
  • not_authed - No authentication token provided.
  • internal_error - The server could not complete your operation(s) without encountering an error, likely due to a transient issue on our end. It's possible some aspect of the operation succeeded before the error was raised.
  • enterprise_is_restricted - The method cannot be called from an Enterprise.
  • no_permission - The workspace token used in this request does not have the permissions necessary to complete the request. Make sure your app is a member of the conversation it's attempting to post a message to.
  • access_denied - Access to a resource specified in the request is denied.
  • too_many_attachments - Too many attachments were provided with this message. A maximum of 100 attachments are allowed on a message.
  • team_added_to_org - The workspace associated with your request is currently undergoing migration to an Enterprise Organization. Web API and other platform operations will be intermittently unavailable until the transition is complete.
  • message_not_found - No message exists with the requested timestamp.
  • missing_scope - The token used is not granted the specific scope permissions required to complete this request.
  • missing_post_type - The method was called via a POST request and included a data payload, but the request did not include a Content-Type header.
  • accesslimited - Access to this method is limited on the current network
  • 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.
  • token_expired - Authentication token has expired
  • file_deleted - File to share deleted.
  • cant_broadcast_message - Unable to broadcast this message.
  • invalid_charset - The method was called via a POST request, but the charset specified in the Content-Type header was invalid. Valid charset names are: utf-8 iso-8859-1.
  • method_deprecated - The method has been deprecated.
  • 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.
  • not_allowed_token_type - The token type used in this request is not allowed.
  • org_login_required - The workspace is undergoing an enterprise migration and will not be available until migration is complete.
  • invalid_auth - Some aspect of authentication cannot be validated. Either the provided token is invalid or the request originates from an IP address disallowed from making the request.
  • block_mismatch - Rich-text blocks cannot be replaced with non-rich-text blocks
  • metadata_too_large - Metadata exceeds size limit