slack_web_api v1.2.1 SlackWebAPI.Api.Chat
API calls for all endpoints tagged Chat
.
Link to this section Summary
Functions
Deletes a message.
Deletes a pending scheduled message from the queue.
Retrieve a permalink URL for a specific extant message
Share a me message into a channel.
Sends an ephemeral message to a user in a channel.
Sends a message to a channel.
Schedules a message to be sent to a channel.
Returns a list of scheduled messages.
Provide custom unfurl behavior for user-posted URLs
Updates a message.
Link to this section Functions
chat_delete(connection, opts \\ [])
chat_delete(Tesla.Env.client(), keyword()) :: {:ok, map()} | {:error, Tesla.Env.t()}
Deletes a message.
Parameters
- connection (SlackWebAPI.Connection): Connection to server
opts (KeywordList): [optional] Optional parameters
- :token (String.t): Authentication token. Requires scope:
chat:write
- :as_user (boolean()): 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 withchat:write:bot
scope. - :ts (float()): Timestamp of the message to be deleted.
- :channel (String.t): Channel containing the message to be deleted.
- :token (String.t): Authentication token. Requires scope:
Returns
{:ok, %{}} on success {:error, info} on failure
chat_delete_scheduled_message(connection, opts \\ [])
chat_delete_scheduled_message(Tesla.Env.client(), keyword()) :: {:ok, map()} | {:error, Tesla.Env.t()}
Deletes a pending scheduled message from the queue.
Parameters
- connection (SlackWebAPI.Connection): Connection to server
- opts (KeywordList): [optional] Optional parameters
Returns
{:ok, %{}} on success {:error, info} on failure
chat_get_permalink(connection, opts \\ [])
chat_get_permalink(Tesla.Env.client(), keyword()) :: {:ok, map()} | {:error, Tesla.Env.t()}
Retrieve a permalink URL for a specific extant message
Parameters
- connection (SlackWebAPI.Connection): Connection to server
opts (KeywordList): [optional] Optional parameters
- :token (String.t): Authentication token. Requires scope:
none
- :message_ts (float()): A message's
ts
value, uniquely identifying it within a channel - :channel (String.t): The ID of the conversation or channel containing the message
- :token (String.t): Authentication token. Requires scope:
Returns
{:ok, %{}} on success {:error, info} on failure
chat_me_message(connection, opts \\ [])
chat_me_message(Tesla.Env.client(), keyword()) :: {:ok, map()} | {:error, Tesla.Env.t()}
Share a me message into a channel.
Parameters
- connection (SlackWebAPI.Connection): Connection to server
opts (KeywordList): [optional] Optional parameters
- :token (String.t): Authentication token. Requires scope:
chat:write:user
- :text (String.t): Text of the message to send.
- :channel (String.t): Channel to send message to. Can be a public channel, private group or IM channel. Can be an encoded ID, or a name.
- :token (String.t): Authentication token. Requires scope:
Returns
{:ok, %{}} on success {:error, info} on failure
chat_post_ephemeral(connection, opts \\ [])
chat_post_ephemeral(Tesla.Env.client(), keyword()) :: {:ok, map()} | {:error, Tesla.Env.t()}
Sends an ephemeral message to a user in a channel.
Parameters
- connection (SlackWebAPI.Connection): Connection to server
opts (KeywordList): [optional] Optional parameters
- :token (String.t): Authentication token. Requires scope:
chat:write
- :thread_ts (float()): Provide another message's
ts
value to post this message in a thread. Avoid using a reply'sts
value; use its parent's value instead. Ephemeral messages in threads are only shown if there is already an active thread. - :blocks (String.t): A JSON-based array of structured blocks, presented as a URL-encoded string.
- :attachments (String.t): A JSON-based array of structured attachments, presented as a URL-encoded string.
- :as_user (boolean()): 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.
- :parse (String.t): Change how messages are treated. Defaults to
none
. See below. - :text (String.t): Text of the message to send. See below for an explanation of formatting. This field is usually required, unless you're providing only
attachments
instead. - :user (String.t):
id
of the user who will receive the ephemeral message. The user should be in the channel specified by thechannel
argument. - :link_names (boolean()): Find and link channel names and usernames.
- :channel (String.t): Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name.
- :token (String.t): Authentication token. Requires scope:
Returns
{:ok, %{}} on success {:error, info} on failure
chat_post_message(connection, opts \\ [])
chat_post_message(Tesla.Env.client(), keyword()) :: {:ok, map()} | {:error, Tesla.Env.t()}
Sends a message to a channel.
Parameters
- connection (SlackWebAPI.Connection): Connection to server
opts (KeywordList): [optional] Optional parameters
- :token (String.t): Authentication token. Requires scope:
chat:write
- :attachments (String.t): A JSON-based array of structured attachments, presented as a URL-encoded string.
- :unfurl_links (boolean()): Pass true to enable unfurling of primarily text-based content.
- :text (String.t): Text of the message to send. See below for an explanation of formatting. This field is usually required, unless you're providing only
attachments
instead. Provide no more than 40,000 characters or risk truncation. - :unfurl_media (boolean()): Pass false to disable unfurling of media content.
- :parse (String.t): Change how messages are treated. Defaults to
none
. See below. - :as_user (boolean()): Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below.
- :mrkdwn (boolean()): Disable Slack markup parsing by setting to
false
. Enabled by default. - :channel (String.t): Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details.
- :username (String.t): Set your bot's user name. Must be used in conjunction with
as_user
set to false, otherwise ignored. See authorship below. - :blocks (String.t): A JSON-based array of structured blocks, presented as a URL-encoded string.
- :icon_emoji (String.t): Emoji to use as the icon for this message. Overrides
icon_url
. Must be used in conjunction withas_user
set tofalse
, otherwise ignored. See authorship below. - :link_names (boolean()): Find and link channel names and usernames.
- :reply_broadcast (boolean()): Used in conjunction with
thread_ts
and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults tofalse
. - :thread_ts (float()): Provide another message's
ts
value to make this message a reply. Avoid using a reply'sts
value; use its parent instead. - :icon_url (String.t): URL to an image to use as the icon for this message. Must be used in conjunction with
as_user
set to false, otherwise ignored. See authorship below.
- :token (String.t): Authentication token. Requires scope:
Returns
{:ok, %{}} on success {:error, info} on failure
chat_schedule_message(connection, opts \\ [])
chat_schedule_message(Tesla.Env.client(), keyword()) :: {:ok, map()} | {:error, Tesla.Env.t()}
Schedules a message to be sent to a channel.
Parameters
- connection (SlackWebAPI.Connection): Connection to server
opts (KeywordList): [optional] Optional parameters
- :token (String.t): Authentication token. Requires scope:
chat:write
- :thread_ts (float()): Provide another message's
ts
value to make this message a reply. Avoid using a reply'sts
value; use its parent instead. - :blocks (String.t): A JSON-based array of structured blocks, presented as a URL-encoded string.
- :attachments (String.t): A JSON-based array of structured attachments, presented as a URL-encoded string.
- :unfurl_links (boolean()): Pass true to enable unfurling of primarily text-based content.
- :text (String.t): Text of the message to send. See below for an explanation of formatting. This field is usually required, unless you're providing only
attachments
instead. Provide no more than 40,000 characters or risk truncation. - :link_names (boolean()): Find and link channel names and usernames.
- :unfurl_media (boolean()): Pass false to disable unfurling of media content.
- :parse (String.t): Change how messages are treated. Defaults to
none
. See below. - :as_user (boolean()): Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below.
- :post_at (String.t): Unix EPOCH timestamp of time in future to send the message.
- :channel (String.t): Channel, private group, or DM channel to send message to. Can be an encoded ID, or a name. See below for more details.
- :reply_broadcast (boolean()): Used in conjunction with
thread_ts
and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults tofalse
.
- :token (String.t): Authentication token. Requires scope:
Returns
{:ok, %{}} on success {:error, info} on failure
chat_scheduled_messages_list(connection, opts \\ [])
chat_scheduled_messages_list(Tesla.Env.client(), keyword()) :: {:ok, map()} | {:error, Tesla.Env.t()}
Returns a list of scheduled messages.
Parameters
- connection (SlackWebAPI.Connection): Connection to server
opts (KeywordList): [optional] Optional parameters
- :cursor (String.t): For pagination purposes, this is the
cursor
value returned from a previous call tochat.scheduledmessages.list
indicating where you want to start this call from. - :token (String.t): Authentication token. Requires scope:
none
- :limit (integer()): Maximum number of original entries to return.
- :oldest (float()): A UNIX timestamp of the oldest value in the time range
- :channel (String.t): The channel of the scheduled messages
- :latest (float()): A UNIX timestamp of the latest value in the time range
- :cursor (String.t): For pagination purposes, this is the
Returns
{:ok, %{}} on success {:error, info} on failure
chat_unfurl(connection, opts \\ [])
chat_unfurl(Tesla.Env.client(), keyword()) :: {:ok, map()} | {:error, Tesla.Env.t()}
Provide custom unfurl behavior for user-posted URLs
Parameters
- connection (SlackWebAPI.Connection): Connection to server
opts (KeywordList): [optional] Optional parameters
- :token (String.t): Authentication token. Requires scope:
links:write
- :user_auth_message (String.t): Provide a simply-formatted string to send as an ephemeral message to the user as invitation to authenticate further and enable full unfurling behavior
- :user_auth_required (boolean()): Set to
true
or1
to indicate the user must install your Slack app to trigger unfurls for this domain - :unfurls (String.t): URL-encoded JSON map with keys set to URLs featured in the the message, pointing to their unfurl blocks or message attachments.
- :ts (String.t): Timestamp of the message to add unfurl behavior to.
- :user_auth_url (String.t): Send users to this custom URL where they will complete authentication in your app to fully trigger unfurling. Value should be properly URL-encoded.
- :channel (String.t): Channel ID of the message
- :token (String.t): Authentication token. Requires scope:
Returns
{:ok, %{}} on success {:error, info} on failure
chat_update(connection, opts \\ [])
chat_update(Tesla.Env.client(), keyword()) :: {:ok, map()} | {:error, Tesla.Env.t()}
Updates a message.
Parameters
- connection (SlackWebAPI.Connection): Connection to server
opts (KeywordList): [optional] Optional parameters
- :token (String.t): Authentication token. Requires scope:
chat:write
- :blocks (String.t): A JSON-based array of structured blocks, presented as a URL-encoded string.
- :attachments (String.t): A JSON-based array of structured attachments, presented as a URL-encoded string. This field is required when not presenting
text
. - :text (String.t): New text for the message, using the default formatting rules. It's not required when presenting
attachments
. - :ts (float()): Timestamp of the message to be updated.
- :parse (String.t): Change how messages are treated. Defaults to
client
, unlikechat.postMessage
. See below. - :as_user (boolean()): Pass true to update the message as the authed user. Bot users in this context are considered authed users.
- :link_names (boolean()): Find and link channel names and usernames. Defaults to
none
. See below. - :channel (String.t): Channel containing the message to be updated.
- :token (String.t): Authentication token. Requires scope:
Returns
{:ok, %{}} on success {:error, info} on failure