InTouch Hub · Blue Isle Software

Slack

Call the Slack Web API to post messages, list channels, read history, and look up users.

slackmessagingchatwebapi

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

Getting the apiKey (token)

  1. Create a Slack app at https://api.slack.com/appsFrom scratch.
  2. Under OAuth & Permissions, add Bot Token Scopes: chat:write, channels:read, channels:history, users:read.
  3. Install to Workspace and copy the Bot User OAuth Token (starts with xoxb-). A user token (xoxp-) also works.
  4. For posting/reading a private channel, invite the bot to it: /invite @YourApp.

Examples

Post a message:

slack apiKey=xoxb-... operation=chat.postMessage channel=C0123ABCD text="Build #42 passed ✅"

List the workspace's channels:

slack apiKey=xoxb-... operation=conversations.list limit=200

Read the 50 most recent messages in a channel:

slack apiKey=xoxb-... operation=conversations.history channel=C0123ABCD limit=50

Look up a user:

slack apiKey=xoxb-... operation=users.info user=U0123ABCD