Templates · Messaging
Slack Web API collection template
Post messages, read channels and list users with the Slack Web API.
What's inside
Send a message to a channel, reply in a thread, read channel history and list users with a Slack bot token. Handy for testing a bot or a release notification before wiring it into code.
6 requests in 2 folders · Base URL https://slack.com/api · Bearer token
Set it up
- Open Slack Web API in Requestarium (or in the app: Import, Start from a template) and import it. You get the collection and a "Slack Web API" environment.
- Create a Slack app at api.slack.com/apps, add the chat:write, channels:read, channels:history and users:read bot scopes, install it and copy the Bot User OAuth Token (xoxb-…). Invite the bot to the channel.
- Fill in the environment, pick it in the environment menu and send the first request.
Environment variables
| Variable | What it is |
|---|---|
slackBotTokensecret | Bot User OAuth Token, xoxb-… |
channelId | Channel id, like C0123456789 (channel details, About). |
messageTs | Filled by "Post a message"; the thread to reply in. |
Requests
Messages
- POSTCheck the token
/auth.testWhich workspace and bot the token belongs to.
- POSTPost a message
/chat.postMessagePosts to the channel and saves the message ts.
- POSTReply in a thread
/chat.postMessageReplies to the message above.
- GETRead channel history
/conversations.historyThe latest messages in the channel.
Channels and users
- GETList channels
/conversations.listPublic channels with their ids.
- GETList users
/users.listMembers of the workspace.