Skip to Content
OpenInspect
Automations

Slack message triggers

Start a session when a matching message is posted in a watched Slack channel, reply in the thread, and continue the session from thread replies.

Last reviewed View as MarkdownEdit on GitHubGive feedback

A Slack Message automation watches one or more channels and starts a session when a message matches its conditions, without anyone mentioning the bot.

How this differs from @mention sessions

Mentioning the bot in Slack starts an explicit, interactive session for the person who asked. A Slack Message automation fires on ordinary channel traffic that matches conditions you define, runs the automation's saved instructions, and posts its result back into the message's thread. Messages that mention the bot are handled by the interactive flow and never double-fire as triggers. See Slack integration for the interactive flow.

Prerequisites

The Slack app needs more than the standard @mention setup. An operator must:

  • Subscribe the app to the message.channels event (public channels) and, for private channels, message.groups.
  • Grant the bot token scopes channels:history and, for private channels, groups:history. Channel listing in the web form also needs channels:read and groups:read.
  • Invite the bot to every channel to watch. The bot only sees messages in channels it is a member of.

Slack automations take zero or one repository. Multi-repository fan-out is not available.

Team scope and publication

An automation run uses the automation's saved owning team, not the posting user's choice of team. Slack channel bindings route new interactive requests; do not assume binding a watched channel transfers an existing automation or session to that team.

For team-owned automations, the executor and repository grants must satisfy automation execution authorization. A Slack User condition filters trigger messages; it is not an OpenInspect membership or repository grant, and it does not authorize all later thread replies.

Slack output has a separate live publication gate. Private-session output is refused, as is output to a channel bound to a different owning team, including workspace-visible sessions. Managed completion and media delivery do not bypass that gate. An unbound channel is not automatically a cross-team refusal, so channel bindings are not an outbound allowlist.

TEAMS_ENFORCEMENT still defaults to shadow, not on. These execution and publication checks do not imply full team-read isolation in that mode.

Conditions

A Slack automation must have a Slack Channel condition; the form blocks saving with "Slack triggers require at least one Slack Channel condition." The other conditions are optional. A message starts a run only when every condition passes. Conditions match against the triggering message's text only, never against thread history.

ConditionRequiredHow it matches
Slack ChannelYesThe message was posted in one of the selected channels. Pick channels by name from the list; if the list cannot load, type channel ids such as C0123ABCD. Channels the bot has not joined are marked "bot not in channel".
Message TextNoThe message text matches. Modes: contains (substring), exact (whole message), or regex (regular expression). A Case-insensitive checkbox sets the i flag. Regex patterns are limited to 200 characters and the i and m flags; an invalid pattern is rejected on save.
Slack UserNoThe author's Slack user id (for example U0123ABCD) or, for a bot, its bot id (for example B0123ABCD) is in the list (include) or not in the list (exclude).

Without a Message Text condition, every message in the watched channels starts a run. The bot-mention token is stripped before matching.

Text-only ingestion

Only the message text reaches the agent (up to 8 KB). Attachments are not forwarded: a file_share message is matched on its text like any other, and an image-only message with no text triggers nothing. Use an @mention or DM when the agent needs image input.

Bot messages

Messages posted by other bots and integrations, such as alerting tools, CI notifications, and incoming webhooks, are ignored by default. Turn on Trigger on bot messages to let them start runs. The automation must also have a Slack User include condition listing the bot ids allowed to trigger it; saving is refused without one. That list limits people too, so add the user ids of anyone else who should still trigger the automation. The OpenInspect bot's own messages never trigger an automation.

  • Only a bot message's text is read. An integration that posts its content only in attachments or blocks triggers nothing.
  • A bot can start a run but never continues one. Its reply in a thread that already has a session is dropped.
  • Bot messages can start at most 10 runs of one automation per hour. Later bot messages in that hour are skipped, which stops a loop where a run's output makes another bot post in the watched channel. The first skip in the hour appears in the run history; the rest are not recorded. Bot messages that arrive at the same moment can overshoot the limit, since each is checked before the others are counted. Messages from people are not limited.
  • The agent is told the message came from a bot.

No extra Slack scope is needed: bot posts arrive on the same message.channels and message.groups subscriptions.

Thread context

When the triggering message is a reply, the agent also receives the thread it belongs to: up to 20 messages posted before the trigger, with the thread's opening message kept alongside the most recent replies. Each message is truncated to 1,024 characters and carries its Slack timestamp and a speaker identity. The history is passed as JSON and labelled untrusted, so the agent reads it as a record of a conversation rather than as instructions.

The thread is fetched only after a run is admitted, so unmatched messages, thread follow-ups, and skipped or duplicate firings cost nothing. If Slack cannot be read, the run starts without history rather than failing.

What the agent receives

The prompt is your instructions, then a context block, then a guardrail line. The block says which channel and author (a user or a bot) the message came from, includes a permalink when Slack returns one, includes any thread history, and wraps the message text in a user_content tag.

Run feedback

  • The triggering message gets an eyes reaction while the run is in flight.
  • When the run finishes, the agent's final response is posted as a reply in the message's thread, with links to any pull requests it opened and to the web session, and the reaction is cleared.
  • A failed run posts a short failure notice in the thread instead.

Declining to reply

If the agent's entire final message is NO_REPLY (or empty), nothing is posted and only the reaction is cleared. Because every reply in a watched thread wakes the automation, an automation on a busy channel would otherwise answer messages that need nothing from it. The agent answers everything it is woken for unless told otherwise, so put the sentinel in the instructions:

If the message needs nothing from you, reply with exactly NO_REPLY and
nothing else.

A run that opened a pull request or produced other artifacts always posts.

Thread replies continue the session

Authorized replies in a thread continue the same session, while the run starts, during it, and after it finishes, until the session has been idle for 7 days. An admitted reply is queued as a follow-up prompt on that session (re-spawned from a snapshot if it had gone idle), gets its own eyes reaction, and the agent posts its response while publication is allowed. A follow-up does not need to match the trigger conditions: conditions gate new runs, not replies that continue a thread. The scheduler checks the reply author's session collaboration access separately.

An unauthorized reply does not fall through to start a new run for that automation. This scheduler path is distinct from interactive mapped-thread handling: if there is no steerable session, or enqueueing fails, the scheduler can re-evaluate the reply as a new trigger. Publication can still be refused after a run is admitted.

Two edge cases:

  • A reply that arrives while the run is still starting is held and queued right after the run's own first prompt. Only a reply that races the very first trigger before its run exists gets an ephemeral "a run is already active" notice instead.
  • A reply after the session has been idle for 7 days starts a fresh run.

Attachments on thread replies are not forwarded either.

Threat model

Channel triggers widen who can start a coding session. Before enabling one:

  • Any member of a watched channel can supply a matching trigger unless conditions restrict them. Treat each watched channel as a source of untrusted requests to the automation's executor; membership and grant checks do not make that message trustworthy.
  • Prefer an allowlist: add a Slack User condition with include so only specific people can trigger it, and keep watched channels small.
  • Bot output is untrusted input that can start autonomous work. List only bots you trust in the required Slack User include condition. Anyone holding an incoming-webhook URL for the channel can post as that integration.
  • Message text reaches the agent as part of the prompt. Scope the instructions defensively and rely on the deployment's repository access boundary.
  • Regex conditions run without a per-match timeout. Patterns are length-capped and validated on save, but a pathological pattern is the author's responsibility.

Troubleshooting

SymptomCauseFix
"Couldn't list Slack channels" in the channel pickerThe Slack app lacks channels:read / groups:read, or has no bot tokenType channel ids manually, or ask an operator to add the scopes
"The bot isn't a member of some selected channels"The bot was not invitedInvite the bot to each watched channel
Messages in the channel start nothingThe app is not subscribed to message.channels / message.groups, lacks history scopes, or the message mentioned the botComplete the Slack app setup; mentions go to the interactive flow
An image posted in the channel starts nothingSlack automations ingest text onlyAdd text to the message, or use an @mention
The automation replies to every messageNo Message Text condition and no NO_REPLY instructionAdd a text condition, and tell the agent when to reply with NO_REPLY
Alerts posted by a bot start nothingTrigger on bot messages is off, the bot's id is not in the Slack User include list, or it posts only attachmentsTurn the setting on, list the bot id, and make sure it sets text
The form refuses a regexThe pattern exceeds 200 characters, uses a flag other than i or m, or does not compileShorten or fix the pattern

Next steps

On this page