slack_web_api v1.2.1 SlackWebAPI.Api.Im

API calls for all endpoints tagged Im.

Link to this section Summary

Functions

Close a direct message channel.

Fetches history of messages and events from direct message channel.

Lists direct message channels for the calling user.

Sets the read cursor in a direct message channel.

Opens a direct message channel.

Retrieve a thread of messages posted to a direct message conversation

Link to this section Functions

Link to this function

im_close(connection, opts \\ [])

im_close(Tesla.Env.client(), keyword()) ::
  {:ok, map()} | {:error, Tesla.Env.t()}

Close a direct message channel.

Parameters

  • connection (SlackWebAPI.Connection): Connection to server
  • opts (KeywordList): [optional] Optional parameters

Returns

{:ok, %{}} on success {:error, info} on failure

Link to this function

im_history(connection, opts \\ [])

im_history(Tesla.Env.client(), keyword()) ::
  {:ok, map()} | {:error, Tesla.Env.t()}

Fetches history of messages and events from direct message 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: im:history
    • :oldest (float()): Start of time range of messages to include in results.
    • :channel (String.t): Direct message 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

Link to this function

im_list(connection, opts \\ [])

im_list(Tesla.Env.client(), keyword()) ::
  {:ok, map()} | {:error, Tesla.Env.t()}

Lists direct message channels for the calling user.

Parameters

  • connection (SlackWebAPI.Connection): Connection to server
  • opts (KeywordList): [optional] Optional parameters

    • :cursor (String.t): Paginate through collections of data by setting the cursor parameter to a next_cursor attribute returned by a previous request's response_metadata. Default value fetches the first "page" of the collection. See pagination for more detail.
    • :token (String.t): Authentication token. Requires scope: im: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.

Returns

{:ok, %{}} on success {:error, info} on failure

Link to this function

im_mark(connection, opts \\ [])

im_mark(Tesla.Env.client(), keyword()) ::
  {:ok, map()} | {:error, Tesla.Env.t()}

Sets the read cursor in a direct message channel.

Parameters

  • connection (SlackWebAPI.Connection): Connection to server
  • opts (KeywordList): [optional] Optional parameters

    • :token (String.t): Authentication token. Requires scope: im:write
    • :channel (String.t): Direct message channel to set reading cursor in.
    • :ts (float()): Timestamp of the most recently seen message.

Returns

{:ok, %{}} on success {:error, info} on failure

Link to this function

im_open(connection, opts \\ [])

im_open(Tesla.Env.client(), keyword()) ::
  {:ok, map()} | {:error, Tesla.Env.t()}

Opens a direct message channel.

Parameters

  • connection (SlackWebAPI.Connection): Connection to server
  • opts (KeywordList): [optional] Optional parameters

    • :token (String.t): Authentication token. Requires scope: im:write
    • :return_im (boolean()): Boolean, indicates you want the full IM channel definition in the response.
    • :user (String.t): User to open a direct message channel with.
    • :include_locale (boolean()): Set this to true to receive the locale for this im. Defaults to false

Returns

{:ok, %{}} on success {:error, info} on failure

Link to this function

im_replies(connection, opts \\ [])

im_replies(Tesla.Env.client(), keyword()) ::
  {:ok, map()} | {:error, Tesla.Env.t()}

Retrieve a thread of messages posted to a direct message conversation

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: im:history
    • :channel (String.t): Direct message channel to fetch thread from

Returns

{:ok, %{}} on success {:error, info} on failure