slack_web_api v1.2.1 SlackWebAPI.Api.Channels
API calls for all endpoints tagged Channels
.
Link to this section Summary
Functions
Archives a channel.
Creates a channel.
Fetches history of messages and events from a channel.
Gets information about a channel.
Invites a user to a channel.
Joins a channel, creating it if needed.
Removes a user from a channel.
Leaves a channel.
Lists all channels in a Slack team.
Sets the read cursor in a channel.
Renames a channel.
Retrieve a thread of messages posted to a channel
Sets the purpose for a channel.
Sets the topic for a channel.
Unarchives a channel.
Link to this section Functions
channels_archive(connection, opts \\ [])
channels_archive(Tesla.Env.client(), keyword()) :: {:ok, map()} | {:error, Tesla.Env.t()}
Archives a channel.
Parameters
- connection (SlackWebAPI.Connection): Connection to server
opts (KeywordList): [optional] Optional parameters
- :token (String.t): Authentication token. Requires scope:
channels:write
- :channel (String.t): Channel to archive
- :token (String.t): Authentication token. Requires scope:
Returns
{:ok, %{}} on success {:error, info} on failure
channels_create(connection, opts \\ [])
channels_create(Tesla.Env.client(), keyword()) :: {:ok, map()} | {:error, Tesla.Env.t()}
Creates a channel.
Parameters
- connection (SlackWebAPI.Connection): Connection to server
opts (KeywordList): [optional] Optional parameters
- :token (String.t): Authentication token. Requires scope:
channels:write
- :validate (boolean()): Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.
- :name (String.t): Name of channel to create
- :token (String.t): Authentication token. Requires scope:
Returns
{:ok, %{}} on success {:error, info} on failure
channels_history(connection, opts \\ [])
channels_history(Tesla.Env.client(), keyword()) :: {:ok, map()} | {:error, Tesla.Env.t()}
Fetches history of messages and events from a channel.
Parameters
- connection (SlackWebAPI.Connection): Connection to server
opts (KeywordList): [optional] Optional parameters
- :count (integer()): Number of messages to return, between 1 and 1000.
- :unreads (boolean()): Include
unread_count_display
in the output? - :inclusive (boolean()): Include messages with latest or oldest timestamp in results.
- :token (String.t): Authentication token. Requires scope:
channels:history
- :oldest (float()): Start of time range of messages to include in results.
- :channel (String.t): Channel to fetch history for.
- :latest (float()): End of time range of messages to include in results.
Returns
{:ok, %{}} on success {:error, info} on failure
channels_info(connection, opts \\ [])
channels_info(Tesla.Env.client(), keyword()) :: {:ok, map()} | {:error, Tesla.Env.t()}
Gets information about a channel.
Parameters
- connection (SlackWebAPI.Connection): Connection to server
opts (KeywordList): [optional] Optional parameters
- :token (String.t): Authentication token. Requires scope:
channels:read
- :include_locale (boolean()): Set this to
true
to receive the locale for this channel. Defaults tofalse
- :channel (String.t): Channel to get info on
- :token (String.t): Authentication token. Requires scope:
Returns
{:ok, %{}} on success {:error, info} on failure
channels_invite(connection, opts \\ [])
channels_invite(Tesla.Env.client(), keyword()) :: {:ok, map()} | {:error, Tesla.Env.t()}
Invites a user to a channel.
Parameters
- connection (SlackWebAPI.Connection): Connection to server
opts (KeywordList): [optional] Optional parameters
- :token (String.t): Authentication token. Requires scope:
channels:write
- :user (String.t): User to invite to channel.
- :channel (String.t): Channel to invite user to.
- :token (String.t): Authentication token. Requires scope:
Returns
{:ok, %{}} on success {:error, info} on failure
channels_join(connection, opts \\ [])
channels_join(Tesla.Env.client(), keyword()) :: {:ok, map()} | {:error, Tesla.Env.t()}
Joins a channel, creating it if needed.
Parameters
- connection (SlackWebAPI.Connection): Connection to server
opts (KeywordList): [optional] Optional parameters
- :token (String.t): Authentication token. Requires scope:
channels:write
- :validate (boolean()): Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.
- :name (String.t): Name of channel to join
- :token (String.t): Authentication token. Requires scope:
Returns
{:ok, %{}} on success {:error, info} on failure
channels_kick(connection, opts \\ [])
channels_kick(Tesla.Env.client(), keyword()) :: {:ok, map()} | {:error, Tesla.Env.t()}
Removes a user from a channel.
Parameters
- connection (SlackWebAPI.Connection): Connection to server
opts (KeywordList): [optional] Optional parameters
- :token (String.t): Authentication token. Requires scope:
channels:write
- :user (String.t): User to remove from channel.
- :channel (String.t): Channel to remove user from.
- :token (String.t): Authentication token. Requires scope:
Returns
{:ok, %{}} on success {:error, info} on failure
channels_leave(connection, opts \\ [])
channels_leave(Tesla.Env.client(), keyword()) :: {:ok, map()} | {:error, Tesla.Env.t()}
Leaves a channel.
Parameters
- connection (SlackWebAPI.Connection): Connection to server
opts (KeywordList): [optional] Optional parameters
- :token (String.t): Authentication token. Requires scope:
channels:write
- :channel (String.t): Channel to leave
- :token (String.t): Authentication token. Requires scope:
Returns
{:ok, %{}} on success {:error, info} on failure
channels_list(connection, opts \\ [])
channels_list(Tesla.Env.client(), keyword()) :: {:ok, map()} | {:error, Tesla.Env.t()}
Lists all channels in a Slack team.
Parameters
- connection (SlackWebAPI.Connection): Connection to server
opts (KeywordList): [optional] Optional parameters
- :exclude_members (boolean()): Exclude the
members
collection from eachchannel
- :cursor (String.t): Paginate through collections of data by setting the
cursor
parameter to anext_cursor
attribute returned by a previous request'sresponse_metadata
. Default value fetches the first "page" of the collection. See pagination for more detail. - :token (String.t): Authentication token. Requires scope:
channels:read
- :limit (integer()): The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached.
- :exclude_archived (boolean()): Exclude archived channels from the list
- :exclude_members (boolean()): Exclude the
Returns
{:ok, %{}} on success {:error, info} on failure
channels_mark(connection, opts \\ [])
channels_mark(Tesla.Env.client(), keyword()) :: {:ok, map()} | {:error, Tesla.Env.t()}
Sets the read cursor in a channel.
Parameters
- connection (SlackWebAPI.Connection): Connection to server
opts (KeywordList): [optional] Optional parameters
- :token (String.t): Authentication token. Requires scope:
channels:write
- :ts (float()): Timestamp of the most recently seen message.
- :channel (String.t): Channel to set reading cursor in.
- :token (String.t): Authentication token. Requires scope:
Returns
{:ok, %{}} on success {:error, info} on failure
channels_rename(connection, opts \\ [])
channels_rename(Tesla.Env.client(), keyword()) :: {:ok, map()} | {:error, Tesla.Env.t()}
Renames a channel.
Parameters
- connection (SlackWebAPI.Connection): Connection to server
opts (KeywordList): [optional] Optional parameters
- :token (String.t): Authentication token. Requires scope:
channels:write
- :validate (boolean()): Whether to return errors on invalid channel name instead of modifying it to meet the specified criteria.
- :name (String.t): New name for channel.
- :channel (String.t): Channel to rename
- :token (String.t): Authentication token. Requires scope:
Returns
{:ok, %{}} on success {:error, info} on failure
channels_replies(connection, opts \\ [])
channels_replies(Tesla.Env.client(), keyword()) :: {:ok, map()} | {:error, Tesla.Env.t()}
Retrieve a thread of messages posted to a channel
Parameters
- connection (SlackWebAPI.Connection): Connection to server
opts (KeywordList): [optional] Optional parameters
- :thread_ts (float()): Unique identifier of a thread's parent message
- :token (String.t): Authentication token. Requires scope:
channels:history
- :channel (String.t): Channel to fetch thread from
Returns
{:ok, %{}} on success {:error, info} on failure
channels_set_purpose(connection, opts \\ [])
channels_set_purpose(Tesla.Env.client(), keyword()) :: {:ok, map()} | {:error, Tesla.Env.t()}
Sets the purpose for a channel.
Parameters
- connection (SlackWebAPI.Connection): Connection to server
opts (KeywordList): [optional] Optional parameters
- :token (String.t): Authentication token. Requires scope:
channels:write
- :purpose (String.t): The new purpose
- :channel (String.t): Channel to set the purpose of
- :token (String.t): Authentication token. Requires scope:
Returns
{:ok, %{}} on success {:error, info} on failure
channels_set_topic(connection, opts \\ [])
channels_set_topic(Tesla.Env.client(), keyword()) :: {:ok, map()} | {:error, Tesla.Env.t()}
Sets the topic for a channel.
Parameters
- connection (SlackWebAPI.Connection): Connection to server
opts (KeywordList): [optional] Optional parameters
- :token (String.t): Authentication token. Requires scope:
channels:write
- :topic (String.t): The new topic
- :channel (String.t): Channel to set the topic of
- :token (String.t): Authentication token. Requires scope:
Returns
{:ok, %{}} on success {:error, info} on failure
channels_unarchive(connection, opts \\ [])
channels_unarchive(Tesla.Env.client(), keyword()) :: {:ok, map()} | {:error, Tesla.Env.t()}
Unarchives a channel.
Parameters
- connection (SlackWebAPI.Connection): Connection to server
opts (KeywordList): [optional] Optional parameters
- :token (String.t): Authentication token. Requires scope:
channels:write
- :channel (String.t): Channel to unarchive
- :token (String.t): Authentication token. Requires scope:
Returns
{:ok, %{}} on success {:error, info} on failure