ExBot v0.1.1 ExBot.Slack
This module provides access to a few Slack Web API calls, as well as maintaining a cache of user and channel information for quick lookups.
Link to this section Summary
Functions
Add a reaction to a message. The timestamp of the message should be part of the message’s event
Fetch channel information by the channel’s ID, ex. “C2147483705”
Fetch channel information by the channel’s name, ex. “general”
Requests a Real Time Messaging session from Slack. Returns a tuple containing the websocket URL, the id of the bot requesting the session, and the name of the bot requesting the session
Get information about the user identified by user_id
Posts a message through the Slack REST API instead of via Websocket
Link to this section Functions
Add a reaction to a message. The timestamp of the message should be part of the message’s event.
Example
msg = %{
type: "message",
channel: "C2147483705",
user: "U2147483697",
text: "Hello world",
ts: "1355517523.000005"
}
ExBot.Slack.add_reaction(msg.channel, msg.ts, "thumbsup")
Fetch channel information by the channel’s ID, ex. “C2147483705”.
Fetch channel information by the channel’s name, ex. “general”.
Requests a Real Time Messaging session from Slack. Returns a tuple containing the websocket URL, the id of the bot requesting the session, and the name of the bot requesting the session.
Example
{url, bot_id, bot_name} = ExBot.Slack.get_rtm_connection("xo-my-token")
Get information about the user identified by user_id
.
Posts a message through the Slack REST API instead of via Websocket.
Helpful if you need to post a message with fancy formatting, which is not currently supported via the RTM API.