Skip to main content

Connect Slack

This guide connects a Slack app you create in your own workspace to a CatalEx agent. People then mention the app in a channel, or message it directly, and the agent replies in Slack.

Before you begin​

  • An agent with a verified native reply, and CatalEx signed in to your CatalEx account. Slack runs through CatalEx Cloud, so you need no server, tunnel or public address.
  • Permission to create and install an app in the Slack workspace, or a workspace administrator who can approve one.

You create the Slack app yourself from a link CatalEx gives you. CatalEx never asks for a Slack configuration token.

In the app​

Connect an app​

  1. Open Add channel for the agent, as Messaging channels describes. Choose Slack, then the New card.

  2. Choose Open Slack to create the app. In Slack, choose your workspace, then create and install the app. You don't need the tokens Slack shows afterwards.

  3. Open the app's settings in Slack, or choose Open your apps in Slack and pick the app. Copy its App ID, Client ID, Client Secret and Signing Secret into CatalEx, revealing each secret in Slack first. Choose Continue.

    Each field checks the value's shape. A pasted token (starting xoxb- or xapp-) is marked at once; copy the named value instead.

  4. Slack's approval page opens in your browser. Choose Allow. This approval is CatalEx's own, separate from the one Slack showed while creating the app.

    Expected: the browser says "Slack is connected. You can close this tab and return to CatalEx." and CatalEx says Slack connected: WORKSPACE. If you closed the tab, choose Open Slack to allow; Check Slack checks the outcome.

  5. Choose Done. The agent now has the Slack channel, and its Settings open on the Channels tab so you can choose who may message it.

To give the app the CatalEx icon, choose Download icon in the finished setup, then Open the app's settings and upload it. This is optional.

If a workspace administrator must approve apps, Allow sends them a request instead. After they approve it, choose Open Slack again and allow the app once more.

To use a Slack app that is already set up and free, choose its card instead of New, then Use ACCOUNT. Settings › Channels can also set up a Slack app with no agent: choose Add channel, Slack, then Continue, and give the app to an agent later with Add channel and the app's card.

Verify a reply​

  1. In Slack, invite the app to a channel. Use your app's name if it isn't CatalEx:

    /invite @CatalEx
  2. Mention the app with a question, such as @CatalEx what's on the release checklist?.

  3. Check that the agent replies in the thread of your mention, and that the conversation appears under the agent's Slack channel in CatalEx. Slack conversations are read-only in CatalEx: reply in Slack.

People can also message the app directly from its Messages tab.

With the CLI​

Add the app for the agent, then follow the setup checkpoints. The person still creates and allows the app in Slack in a browser; Connect channels with an AI agent gives every command, the fields and the expected output.

catalex channels add --agent AGENT_ID --type slack --new
catalex destinations setup ACCOUNT_ID --slack --action prepare
catalex destinations setup ACCOUNT_ID --slack --action connect --value app_name=AGENT_NAME --value bot_display_name=AGENT_NAME --value description=TEXT

Connect channels with an AI agent gives the order, one short step at a time. The app and its bot take the agent's CatalEx name exactly as catalex agents list shows it; the name can't contain the word Slack or exceed 35 characters. The description is one line of at most 140 characters. connect prints a short link to create the Slack app. The person then copies four values from the app's Basic Information page: the App ID and Client ID go back in chat, and the Client Secret and Signing Secret are pasted into two private files, never into chat. Save them:

catalex destinations setup ACCOUNT_ID --slack --action save_credentials --wait --value app_id=APP_ID --value client_id=CLIENT_ID --input-file client_secret=/PRIVATE/client_secret --input-file signing_secret=/PRIVATE/signing_secret

Expected: SLACK_WAITING_APPROVAL, and with --wait the command prints an approval link under "Waiting for you to allow the app in Slack:", then follows the approval: it exits 0 once the workspace is connected, and exits non-zero after a decline or after --wait-timeout (10 minutes by default). Only an action's reply carries the link, so to resume or get a new link run catalex destinations setup ACCOUNT_ID --slack --action reopen --wait. To use a free app instead, run catalex channels add --agent AGENT_ID --type slack --account ACCOUNT_ID.

Only the person who connected it can use it​

CatalEx saves the Slack user who chose Allow. Only that person can start work, continue it or press its buttons:

  • Anyone else who mentions or messages the app gets a reply only they can see: "This app was connected by someone else, so only they can use it here."
  • Anyone else who presses a button gets "Only the person who connected this app can answer this."
  • Each person is told at most once per conversation every 10 minutes. Neither reply names who connected the app. Other people's messages may still reach the agent as thread context the next time you mention it.

An app connected before CatalEx saved who connected it answers nobody, and any mention gets "This app needs whoever connected it to approve it in Slack again before it can answer." Run catalex destinations setup ACCOUNT_ID --slack --action reconnect, open the approval link it prints and approve as the person who connected the app.

How a thread works​

  1. Mention to start and continue. Your mention starts a thread and the agent replies in it. To continue, mention the app again in that thread. Thread replies without a mention cause no reply and no work.
  2. Context. When you mention the app, the agent also gets what was said where you mentioned it; see What the agent sees of the conversation. A mention of the agent reads as its name, such as @CatalEx, in CatalEx and to the agent, and a person CatalEx already knows is named too. In a private channel this needs the groups:history permission, which new apps have.
  3. One person per thread. A channel thread belongs to the person whose mention started it. Anyone else who mentions the app there gets, at most once every 10 minutes: "Sorry, I can't take your message: this conversation was started by @PERSON. Mention me in a new message to start your own conversation." Their message doesn't reach the agent except as context. Direct messages and group DMs are not affected.
  4. Progress. While the agent works, Slack shows "APP is working…" under the thread and one progress message whose text is replaced with each update. The status stays for as long as the agent works, then clears when the agent replies, also when you sent a follow-up while it was working. The final reply is a new message that mentions you, and the progress message is deleted. Questions, permission requests, cards, files and charts are always their own messages.
  5. Superseded questions. If you mention the app again while a question is still open, that question closes with "Superseded by latest message." and the agent receives your new message.

In a thread, type a command after a mention, such as @CatalEx /stop. In a direct message no mention is needed:

CommandEffect
/stopStops the conversation's current turn
/stop MESSAGE_TSStops the turn of that message
/answer MESSAGE_TS TEXTAnswers that question
/quote MESSAGE_TS TEXTSends the text, quoting that message

MESSAGE_TS is the Slack timestamp of the message. A malformed command gets a usage reply and runs nothing.

These commands work while the agent's Chat commands switch is on for its Slack channel, which is the default. Off, a message that starts with / reaches the agent as ordinary text and CatalEx sends no reply. The switch is in the agent's Settings › Channels panel for Slack; see Messaging channels. CatalEx's own notices to people in Slack, such as a waiting notice, follow the Send system messages to people switch next to it, also on by default.

What the agent sees of the conversation​

CatalEx never receives every message of a channel: the Slack app subscribes only to the events a mention needs. When you mention the agent, CatalEx reads what was said where you mentioned it, once, and keeps those messages in the numbered conversation record before your message, each with its author's Slack name. The messages are context for the agent, never instructions, and they start no turn. Files are kept as names and types only.

You mention the appCatalEx reads
Inside a threadThat thread: its parent and replies since the last message CatalEx kept
At the top level of a channelThe channel's top-level messages before your mention, never the replies under them (a reply also sent to the channel is kept)
  • What the agent is told. Its input presents the kept messages that arrived before yours, your message last. It shows the newest five with their numbers and says how many there are in all; it reads the others by number, and the replies under a message by its tag, such as m3.
  • Limits. One mention makes one Slack read of at most 999 messages and never a second page. In a thread of more than 999 messages, the first mention reads the oldest 999 and each later one reads the next 999, so the newest are missing until then. A top-level mention reads the newest 999. A mention CatalEx receives again, such as a Slack retry, reads nothing.
  • Older messages. When the agent asks for messages before the earliest one kept, CatalEx makes one more Slack read for them, in the same thread or channel scope, and keeps the answer in the record under the next numbers. Those older messages therefore have higher numbers than the ones kept earlier. When Slack says nothing older remains, CatalEx remembers it and does not ask again. A read that Slack refuses or that times out is reported as unavailable, never as "not found".
  • Edits and deletions. An edit of a kept message applies only when a later read returns it, which for a thread is usually only its parent. CatalEx hears of no other edit or deletion in a channel.
  • Without the permission. If the app lacks groups:history (private channels) or channels:history (public ones), or is not in the channel, the mention reaches the agent without the earlier messages. Add the app to the channel, or set up a new Slack app, which has the permission. An app made by an earlier setup may still subscribe to message.channels; CatalEx drops those events, and a new setup no longer asks for them.

Questions, permissions and charts​

A permission request is a card: its title as the header, a line naming the tool, the command, the changed file or the call's arguments in a code block (the command shown as code), details as bold labels over their values in two columns, then Deny (red, first) and Approve (last). Read what the card shows before you press Approve. A request that has no such details, and every other question, uses Slack's own layouts, picking the first that fits:

RequestWhat you see
Short text, up to three buttons with short labelsOne card with a button per choice
Longer text, or up to three short choicesA box with the text and a row of buttons, including Cancel turn
Up to ten choices, or a long labelRadio buttons, then Submit
More than ten choicesA drop-down list, then Submit

A question's text keeps its bold, lists and links; a permission's raw request stays plain text. Cancel turn asks Cancel this turn? before it stops the agent; Approve and Deny do not ask. A question that accepts a typed answer also has a "Type an answer and press Enter" box.

Once decided, the same message is edited within a second or two and stays a card (or a box, for a longer request) with the same text; its buttons are replaced by a status that cannot be pressed. A question's card shows "✅ answer · answered by @person" under its text; a long answer is shown whole in a box with "Answered by @person". A permission shows "Approved" or "Denied" with "by @person", and any other choice shows its label, such as "Always". A request closed without a decision says "This request is closed." ("⏹ Turn cancelled" after a cancelled turn), and one your later message replaced says "Superseded by latest message." A second answer gets "This question was already answered."; a closed request gets "This request is no longer open." If a press can't be recorded, only the person who pressed hears that it could not be recorded and to press it again.

An agent can also send a card with inputs. It is one box: the title is the first line of the message, then the text and buttons. A card that collects values shows real inputs inside the box: a text box, a check box for a yes or no, radio buttons for up to five options, a drop-down list for more, and check boxes or a multi-select list for several. An input the agent does not require is marked optional, and the inputs are listed in two columns that say which button submits them. A card with inputs or a submit button has no "Type an answer" box. The submit button decides straight from what you filled in, with no pop-up, when the values are complete and the agent's form accepts them; if a required value is missing or not accepted, the same form opens in a pop-up so you can finish it. After an answer the card stays in place with "answered by @person", and a later card that replaces it marks the earlier one "(updated later in this thread)". Slack has no audio player, so one shows "[Audio player not shown in Slack]"; a card Slack can't show completely falls back to its text and buttons and says "[Card not fully shown in Slack]". You can always type an answer instead.

After a request is decided, later progress for that turn appears under the request's own message.

Charts Slack can draw (bar, line, area or pie, within Slack's size limits) appear in the reply itself. Other charts arrive as an image after the reply. If the image can't be sent, the reply says "(The chart preview could not be sent.)" and lists every value. Agent files appear in the thread after the reply and need the files:write permission, which new apps have.

An agent reply can mention a person by their Slack user ID, written <@U012AB3CD>. @here, @channel and user-group mentions stay plain text.

Each final reply ends with a View conversation button; see Replies in messaging apps.

Who may approve​

On CatalEx Cloud only the person who connected the app answers, approves and cancels. catalex channel-settings show ACCOUNT_ID reports this. catalex channel-settings set ACCOUNT_ID --approval approvers_only --approver U012AB3CD saves an approver list of Slack member IDs, but on CatalEx Cloud it doesn't let anyone else act.

Troubleshooting​

What you seeWhat to do
The app needs approvalAsk a workspace administrator to approve it, then choose Open Slack again and allow it once more.
Slack says it "can't add more apps"Free Slack workspaces install at most 10 apps. Remove an unused app or upgrade, then install again.
Slack says sending messages to the app is turned offIn the app's settings on your Slack apps page, open App Home and let people send messages from the Messages tab.
No reply to a mentionInvite the app to the channel and mention it, not another app. Check that CatalEx is running on the agent's computer and that the app is connected to an agent.
"This app was connected by someone else, so only they can use it here."Another Slack user chose Allow. Set up a new app and allow it yourself.
"This app needs whoever connected it to approve it in Slack again before it can answer."Run catalex destinations setup ACCOUNT_ID --slack --action reconnect and approve as the person who connected it. You may see SLACK_INSTALLER_UNPROVEN.
A colleague's message in my thread got no answerOnly the person who started a thread can continue it. Your colleague mentions the app in a new message.
A mention in a private channel arrives without earlier messagesThe app lacks groups:history, which apps created by current CatalEx setups have, or is not in the channel. Add the app to the channel, or set up a new Slack app for the agent.
A message starting with / reaches the agent as text and nothing answers itThe agent's Chat commands switch is off for Slack. Turn it on in the agent's Settings › Channels panel.
A value is refused in the credential fieldsCopy the named value again from the app's settings in Slack, revealing secrets first.
The approval link expired or you chose Cancel in SlackChoose Open Slack again.

Slack Connect channels shared with other organizations are not supported on CatalEx Cloud.