Slack
Call the Slack Web API to post messages and read workspace data. Pure Python standard library, no external dependencies.
What it does
Branches on an operation and makes one authenticated call to
https://slack.com/api/<method>. The token is sent in the
Authorization: Bearer <token> header (Slack's preferred scheme); write
operations POST as application/x-www-form-urlencoded.
Slack always responds 200 OK with a JSON body carrying a top-level ok
boolean. On ok:false the tool returns Slack's error string in status
(e.g. not_in_channel, channel_not_found, invalid_auth) rather than
crashing, so the assistant can react.
Operations
| operation | reads/writes | required input | returns in result |
|---|---|---|---|
chat.postMessage |
write | channel, text |
{ts, channel} of the posted message |
conversations.list |
read | — | array of channels (id, name, ...) |
conversations.history |
read | channel |
array of recent messages |
users.info |
read | user |
the user object (profile, name, ...) |
limit (default 100, max 1000) caps conversations.list /
conversations.history. When Slack paginates, the cursor is returned as
nextCursor.
Outputs
result— the useful payload as a JSON stringstatus—okon success, otherwise Slack's error codeok—"true"/"false"operation— echo of the operationnextCursor— present only when more pages are available
Credential
This tool is credential-based. The token is not a task input — it lives in the vault and is bound to the task by name, so it never appears in a workflow definition, an export, or a log.
- Create a Slack app at https://api.slack.com/apps → From scratch.
- Under OAuth & Permissions, add Bot Token Scopes:
chat:write,channels:read,channels:history,users:read. - Install to Workspace and copy the Bot User OAuth Token
(starts with
xoxb-). A user token (xoxp-) also works. - In InTouch, create a credential of type API Key and paste the token as
the secret. Leave
baseUrlempty — Slack's API host is fixed, and the token is what selects the workspace. - Put that credential's name in the task's
credentialNamefield. - For posting/reading a private channel, invite the bot to it:
/invite @YourApp.
Examples
Each assumes an API Key credential named Slack is attached to the task.
Post a message:
slack operation=chat.postMessage channel=C0123ABCD text="Build #42 passed ✅"
List the workspace's channels:
slack operation=conversations.list limit=200
Read the 50 most recent messages in a channel:
slack operation=conversations.history channel=C0123ABCD limit=50
Look up a user:
slack operation=users.info user=U0123ABCD
Publishes
The keys a later task may reference as {{taskName.key}}. Referencing anything not listed here resolves to nothing at run time.
errornextCursorokoperationresultstatus
Input Properties
Every property this tool accepts, from its own tool.iml.
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
operation |
string | yes | — | One of: chat.postMessage, conversations.list, conversations.history, users.info |
channel |
string | no | — | Channel ID (e.g. C0123ABCD) or #name. Required for chat.postMessage and conversations.history. |
text |
string | no | — | Message text. Required for chat.postMessage. |
user |
string | no | — | User ID (e.g. U0123ABCD). Required for users.info. |
limit |
string | no | 100 |
Max items to return for conversations.list / conversations.history (1-1000). |
allowErrors |
string | no | — | Comma-separated Slack error codes to TOLERATE instead of failing the step (e.g. "not_in_channel,channel_not_found"), or "*" for all. Empty means any ok:false from Slack fails the task — which is what you want, because a workflow that reports success while doing nothing is worse than one that stops. |
types |
string | no | public_channel |
Channel types for conversations.list: public_channel (default), private_channel, mpim, im — comma-separated. Anything beyond public_channel needs extra Slack scopes: private_channel requires groups:read, im requires im:read. Left alone, this asks for no more than a public-community digest needs. |