Slack

Post and read Slack messages from a workbench job

The Slack tool is what a workbench agent calls during a job to post messages, read channel history, and manage channels. It is separate from the Slack chatbot, which starts a job when someone @mentions the bot.

Prerequisites

Before you begin, make sure you have:

  • Permission in Plural Console to create a configured tool and edit the target workbench.
  • A Slack app with a bot user, installed to your workspace, with the bot token scopes for the capabilities you want to enable (see below).
  • The bot invited into any private channel it should list, read, post in, or invite members to — a bot only sees private channels it has joined.

Create a Slack app and bot token

  1. Open Slack API: Your Apps and create an app From scratch, or reuse an app you already own.
  2. Open OAuth & Permissions and, under Bot Token Scopes, add the scopes for the operations you want available (see the table below).
  3. Click Install to Workspace, then copy the Bot User OAuth Token (it starts with xoxb-).

Capabilities

Every operation below runs with the bot token's permissions, so a scope that is missing from the token causes that operation to fail even though it is registered.

Operation
What it does
Required bot token scopes
slack_list_channelsList Slack channels (public and private) via conversations.list. Omits archived channels and private channels the bot has not joined.channels:read, groups:read
slack_find_channel_by_nameResolve a channel ID by its name (case-insensitive, without #) via conversations.list.channels:read, groups:read
slack_list_messagesList recent messages in a channel via conversations.history. Each message's ts can be passed to slack_edit_message or slack_react_to_message.channels:history, groups:history
slack_post_messagePost a message to a channel via chat.postMessage. Pass an optional thread_ts to reply in a thread.chat:write
slack_edit_messageEdit an existing message via chat.update.chat:write
slack_react_to_messageAdd an emoji reaction to a message via reactions.add.reactions:write (add reactions:read if agents should also inspect existing reactions)
slack_create_channelCreate a public or private channel via conversations.create. The channel name must use lowercase letters, numbers, hyphens, and underscores, up to 80 characters.channels:manage (public), groups:write (private)
slack_invite_to_channelInvite up to 100 users to a channel via conversations.invite. Accepts user IDs and/or a user group ID, which is expanded via usergroups.users.list.channels:write.invites (public), groups:write.invites (private); add usergroups:read when passing a user group ID
slack_list_user_groupsList Slack user groups (subteams) via usergroups.list, including each group's ID and handle for `<!subteam^IDhandle>` mentions.

To enable every operation, add all of the scopes above to the app's Bot Token Scopes.