Slack Reference
This page documents every part of slackChannel from eve/channels/slack. For setup and common tasks, start with Slack.
The Slack channel connects your agent to a Slack workspace through agent/channels/slack.ts. It answers mentions, DMs, slash commands, shortcuts, and button clicks, replies in threads, and shows approvals and questions as buttons. See Channels for what every channel shares.
Vercel Connect holds the bot token, rotates it, verifies requests, and supports installs in several workspaces, so no Slack secrets go into your project environment. Without Connect, you provide the bot token and signing secret yourself.
Add the channel
Run the guided setup from your agent project:
With Vercel Connect, setup does these steps:
- Signs you in to Vercel and links a project.
- Reuses or creates a Slack app (a Connect connector) and prompts you to install it in a workspace.
- Routes the app's events to
/eve/v1/slack. - Writes the channel file:
Deploy with eve deploy once setup finishes.
Resume setup
Run eve add channel/slack again if setup stops partway or Slack events stop reaching the agent. Setup runs only the missing steps, and finishes the connector that agent/channels/slack.ts names without prompting. It never runs vercel connect detach, which would remove the project's token access and trigger destinations.
Manage Slack credentials yourself
Choose Use portable credentials when the agent doesn't run on Vercel or you can't use Vercel Connect. eve adds SLACK_BOT_TOKEN and SLACK_SIGNING_SECRET to .env.example but doesn't create the Slack app. In Slack app settings:
- Add the
app_mentions:readandchat:writebot scopes, pluschannels:history,groups:history,im:history, andmpim:historyfor DMs and message edits,files:readfor inbound attachments, andfiles:writefor long-response snippets. - Install the app, then set
SLACK_BOT_TOKENto its Bot User OAuth Token andSLACK_SIGNING_SECRETto the signing secret from Basic Information. Put both in.env.localfor local development or in the deployed runtime's environment. - Set the Request URL to
https://your-agent.example/eve/v1/slackunder Event Subscriptions (subscribe toapp_mention, plusmessage.channels,message.groups,message.im, andmessage.mpimfor DMs and message edits), Interactivity & Shortcuts, and each Slash Command.
For an app installed in several workspaces, pass a function as botToken. It receives the installation workspace as { teamId }: credentials: { botToken: ({ teamId }) => loadInstallationToken(teamId) }. Reject a missing teamId instead of falling back to a default installation.
How the channel handles inbound events
Without hooks, the channel answers app mentions and DMs and ignores other messages. Add hooks to slackChannel(...) to decide who can start a turn and which messages reach the agent.
Message hooks
A message hook decides whether a Slack message starts a turn:
- Return
{ auth }to start a turn, ornullto drop the message. - Add
contextto put background in history. - Add
historyto bring in prior conversation; see Start from prior history. - Add
titleto set the run title. Public conversations otherwise use the message text; DMs and private channels always usePrivate message. - Add
status: "deferred"to show no thread status until the agent calls a tool. See Status and guidance. - Add
guidanceto tell the model how to treat this one message.
| Incoming event | Handler order |
|---|---|
| App mention | onAppMention → onMessage → onEvent → built-in mention default |
| Direct message | onDirectMessage → onMessage → onEvent → built-in DM default |
| Un-mentioned code channel message | onMessage → onAppMention → onEvent → built-in default |
| Other Slack message | onMessage → onEvent → ignore |
| Edited message | onMessageEdited → onEvent → the hook a new message of the same kind reaches |
| Other Events API event | onEvent → ignore |
Only the first defined handler runs. A hook that returns null drops the message instead of passing it down the table.
onAppMention(ctx, message)handlesapp_mention. By default, it identifies the sender within their workspace.onDirectMessage(ctx, message)handles DMs, which needmessage.imandim:history. It never receives bot messages.onMessage(ctx, message)handles other posted messages.ctx.isBotMentioned()andctx.isSubscribed()let you answer only mentions or active threads.onMessageEdited(ctx, edit)handles a person's edit to their own message in a thread that already has a session. See Message edits.
Without onMessageEdited, onAppMention, onDirectMessage, and onMessage also decide edits to the messages they receive. ctx.edit holds the edit while a hook decides one, and is unset for a new message. A hook with side effects, such as ctx.send(), ctx.end(), or a decision model call, should check ctx.edit so an edit doesn't repeat them.
eve drops the app's own messages before any hook runs. Other bots' messages reach onMessage; check message.author?.isBot to ignore them.
Hooks don't post anything. eve still acknowledges the message, shows progress, and posts the reply. To change what the agent posts, add renderers.
onInteraction(action, ctx) handles clicks on your own buttons and selects (block_actions). Clicks on eve's approval and question controls go to onAnswers(ctx, submission) instead. To open a modal from a button, pass action.triggerId to ctx.slack.request("views.open", { trigger_id, view }) within about 3 seconds. To replace or delete the message the click came from, POST to action.responseUrl, for example { "delete_original": true }. That is the only way to change an ephemeral message. eve adds the clicking user's Slack ID to the model message.
onShortcut(shortcut, ctx) handles message and global shortcuts configured under Interactivity & Shortcuts. It receives the callback ID, user, workspace, and trigger ID, plus the message and channel for a message shortcut.
onSlashCommand(command, ctx) handles Slash Commands. It receives the command, argument text, user, channel, workspace, trigger ID, and response URL. Both handlers can call the Slack API for the workspace. eve acknowledges the request immediately while the handler runs in the background:
The model sees each message as a <slack_message>. Its metadata blocks are <sender> with the sender's type and id, <bot> with the receiving app's id and mentioned (inbound messages only), and <thread>:
<content> converts mrkdwn to Markdown but keeps <@USER_ID> mentions intact. It also includes the text of link previews and shared messages.
Status and guidance
status on a hook's result sets when eve shows that the agent is working on the message:
status | What the thread shows |
|---|---|
"immediate" (default) | The received acknowledgement when the message arrives, then the thread status through the turn |
"deferred" | Nothing until the turn's first tool call finishes; a turn that ends with no_reply shows nothing |
A call to a tool with label: false shows no status and doesn't count as that first call, so a deferred turn that only adds a reaction and ends with no_reply stays silent.
- Mentions and DMs outside code channels get the
receivedacknowledgement,Thinking...by default, before their hook runs."deferred"keeps the rest of their turn quiet but can't take the acknowledgement back. - When several messages start one turn, the turn is quiet only if all of them are deferred. A message that isn't deferred and joins a quiet turn shows the status from then on.
- Edits are always deferred.
statuson anonMessageEditedresult has no effect. - For other messages, including every code channel message,
"deferred"skips thereceivedacknowledgement, including one your renderer writes. Renderers that set the thread status themselves still do.
guidance adds text you write to this one message. The model sees it as a <guidance> block after the metadata blocks, and after an edit's <diff>, before <content>:
Guidance stays with its message when several messages join one turn. context doesn't: it goes before all of the turn's messages. eve skips guidance that is empty or only whitespace.
The model reads guidance as eve's own annotation, outside the message content. eve encodes the < of its own block tags, such as </content> or <guidance>, inside message text, so a person can't close <content> or forge a guidance block. Never put user-controlled text, such as message text or profile names, in guidance.
Message edits
When a person edits one of their messages in a thread that already has a session, eve sends the edit to that session:
- The edit follows the channel's
turnPolicylike any message. By default it joins a running turn, and if the agent already replied, it starts a new turn. WithturnPolicy: "queue", it waits behind the message it edits. - eve skips the
receivedacknowledgement for the edit. A turn the edit starts shows no status until its first tool call finishes, so an agent that ends the turn withno_replyleaves no trace in the thread. - The edit adds no thread context or files, and doesn't answer an open approval or question.
- eve ignores edits by bots and apps, link previews added to a message, and edits in threads without a session.
By default, eve runs the edited message through the hook a new message of the same kind would reach. A hook that returns null drops the edit:
| Edited message | Hook that decides |
|---|---|
| In a DM | onDirectMessage → onMessage → built-in DM default |
| Mentions the agent, before or after the edit | onAppMention → onMessage → built-in mention default |
| In a code channel | onMessage → onAppMention → built-in default |
| Other | onMessage → ignore |
The built-in defaults send the edit with the author's workspace-scoped auth. An edit that removes the mention still reaches the agent, so it can tell it's no longer wanted. The hook's guidance goes into the edit's block, so with the hook in Continue conversations without repeated mentions, an edit to a followed reply arrives with the same guidance.
Set onMessageEdited(ctx, edit) to choose which edits reach the agent instead. Return { auth } to send the edit, or null to drop it. edit.message is the edited message at its original ts, edit.previousText is the text before the edit, and edit.editedTs is when the edit happened. For an edit, ctx.isBotMentioned() returns whether the message mentioned the agent before or after the edit, and ctx.edit holds the same edit as the hook's argument. An authored onEvent comes before the default but not before onMessageEdited.
This hook sends every edit in a thread with a session, including replies without a mention. Apply the same checks as your other hooks before returning { auth }:
With messageContext.users, the author is looked up before onMessageEdited runs. An agent that may hear about edits it has nothing to add to should have the no_reply tool and instructions to use it, such as "When a Slack edit doesn't change what you need to do, end your turn with no_reply."
The model sees the edit as a <slack_message_edit> with the usual metadata blocks. <edit> holds edited_ts, <diff> lists the removed (-) and added (+) lines, and <content> holds the full edited message:
Slack doesn't always include the text before an edit. Then, and for a message too long to compare, <edit> has a diff: line that says why there is no <diff>.
Slack sends edits only through the message.channels, message.groups, message.im, and message.mpim events, which need the channels:history, groups:history, im:history, and mpim:history scopes. The generated app manifest includes them. Vercel Connect's defaults include all of them except message.mpim and mpim:history; add those to the connector to receive edits in group DMs.
Add sender names and emails
Slack user ids identify every sender without a lookup. When the agent should also know who someone is, enable messageContext.users:
eve looks up each human sender with users.info and adds display_name and real_name to their <sender> block, plus email with email: true. Set name: false with email: true to add emails only. Thread context replies get the same fields. The triggering author is also written to message.author (fullName, displayName, email) and to the full_name and email attributes of defaultSlackAuth, so a hook can gate on them. Mentions and DMs are looked up before onAppMention or onDirectMessage runs. Other channel messages are looked up only once a hook delivers them, so their hooks see the unresolved author.
users: true adds names only. Results are cached in memory per workspace and user for an hour, and a failed lookup is retried after a minute. A lookup that fails or takes longer than two seconds is left out, and the message is still delivered. To use your own cache, pass resolve; next() is eve's uncached users.info call:
teamId is the workspace whose installation received the message, so key caches on it. messageContext.users adds the users:read scope to the app manifest, and users:read.email with email: true; reinstall the Slack app after enabling it. It is off by default because names and emails then reach model context, session history, and traces.
Restrict who can invoke the agent
A valid Slack signature proves that Slack sent the event, not that the sender should reach your agent. Check the user and conversation in every inbound handler before returning auth. This matters most in Slack Connect channels, where external users can post:
- Override every enabled inbound handler, because an omitted
onDirectMessagekeeps eve's default DM behavior. - Apply the same policy in
onAnswers, so someone who can't start a turn can't resume one by clicking an approval button. - If access depends on organization membership, resolve it from Slack's shared-channel and user data.
- Keep authorization checks in sensitive tools too. The allowlist controls who starts a turn; tool checks control what that user may read or change.
defaultSlackAuth and ctx.defaultAuth identify a person as slack:<team>:<user>. <team> is the app installation workspace when Slack reports one, otherwise the event's team. A Slack Connect user keeps one identity, and one connection sign-in, across messages and button clicks.
onAnswers runs when someone clicks an approval or question control, before the session resumes:
- Return
{ auth }to accept the answer. - Return
nullor throw to reject it and keep the request and its controls open. ctx.defaultAuthidentifies the person who clicked but doesn't authorize them.- Without
onAnswers, Slack accepts every answer with the clicking user's auth.
While onAnswers or approvalChannel is set, only the Slack controls answer a pending request. A message typed in the thread or DM reaches the agent as a new message under the turn policy. With the default "steer" policy, it withdraws an open question.
Post sensitive requests in conversations limited to the intended approvers. Re-check ctx.session.auth.current in a sensitive tool before it changes anything.
Use Slack's action token
Slack sends an action_token with mentions and DMs. The Real-time Search API needs it to search for the person who wrote the message with a bot token. eve reads it into message.actionToken, including the copy Slack nests under assistant_thread, and defaultSlackAuth adds it to the turn's auth as the action_token attribute. With the default hooks, or a hook that returns defaultSlackAuth, a tool reads it without any channel code:
Each message carries its own token, and Slack rejects a token once it expires. Slack also rejects a token sent with another app's bot token, so a remote agent that receives it with a forwarded principal can't search with it.
Continue conversations without repeated mentions
Use onMessage to answer mentions, code channel messages, and DMs, and to follow threads that already have an eve session:
| Check | Why |
|---|---|
message.author?.isBot === false | Another bot replying in the thread would loop. |
| Mention, code channel, or DM | These are addressed to the agent, so they get a plain { auth }. |
message.threadTs !== message.ts | Top-level messages start their own thread, so they still need a mention. |
ctx.edit | An edit only reaches a thread that has a session, so it's followed like a reply, root message included. |
ctx.isSubscribed() | The thread has an active eve session, so the agent follows only threads it was brought into. |
- Without
onAppMentionandonDirectMessage, mentions and DMs reachonMessagetoo, so the hook answers them first. - The DM check reads
channel_type.ctx.isDMOrPrivateChannel()returnstruefor DMs, group DMs, and private channels, and also when it can't tell, such as on a missing scope or API error. - The agent needs the
no_replytool to stay quiet. See Status and guidance for whatstatusandguidancedo. defaultSlackAuthgives each Slack user their own identity, so by default only the person whose message led to an approval can answer it. With{ auth: null }, messages carry no identity, and anyone in the thread can answer it.- A reply from the person a pending question or approval is waiting on can still answer it, even when the reply is meant for someone else, because eve matches answers by identity before the model sees the message.
Thread replies need extra subscriptions. With Vercel Connect, open Advanced when creating the connector. Add message.channels under Trigger Event Types and channels:history under Bot Scopes. Private channels also need message.groups and groups:history.
Classify ambient replies with a decision model
Use decide to let the agent join conversations nobody brought it into. Keep the checks above first, so addressed messages and followed threads cost no decision call. Then ask a decision model about other messages in the channels you choose:
| Stage | Question | Tune it for |
|---|---|---|
decide in onMessage | Could the agent plausibly help here? | Recall: let borderline messages in |
The agent's model, with guidance | Should it actually say something? | Precision: no_reply unless it's useful |
- The decision runs before eve delivers the message, so an ignored message doesn't start a turn.
- Once
decidelets a message through, its thread has a session. Later replies passctx.isSubscribed()without another decision call. - A reply in a watched thread without a session gets the same check. If the decision lets it through, the agent joins the conversation in progress. With
threadContextset, the earlier replies arrive as history. - Every other new unmentioned message in a watched channel costs one decision call, and the decision model sees its text.
- If
decidethrows, eve logs the handler failure and drops the message. Catch the error and return{ auth }when your application should answer anyway.
Pass model to choose the decision model. Make sure it's available through your configured provider and, with Vercel AI Gateway, allowed by the team's provider settings.
ctx.thread.listParticipants() returns the thread's unique human Slack user IDs in the order they first posted. In a thread a person started, the first ID is that person:
It reads at most the first 50 messages and needs the matching history scope. A failed fetch is logged and returns an empty or stale list, so treat an unexpected empty list as "don't route".
Load prior thread messages
By default, the agent sees the triggering mention but not earlier replies in the thread. Set threadContext to add them, labeled with each sender's Slack user ID:
since sets where each mention's context starts:
"thread-root"(default, same asthreadContext: {}): every prior message in the thread."last-agent-reply": messages after this app's last reply, so repeated mentions add only what's new. Other bots' replies don't move the boundary.- A predicate
(message: SlackThreadMessage) => boolean: messages after the last one it matches.
threadContext requires the matching Slack history scope. Use loadThreadContextMessages to filter or process the raw thread messages yourself.
When the triggering message starts the thread's session, eve adds the earlier replies as session history. This app's replies become assistant turns, and other replies become user messages with their Slack user IDs. Those assistant turns hold what Slack shows, which can differ from what the model wrote. Later messages in the thread get the earlier replies as a transcript instead. A hook that returns its own history also gets the transcript.
Control overlapping turns
A Slack message sent during a running turn joins that turn by default (turnPolicy: "steer"). See Overlapping messages for when it interrupts the model. Set turnPolicy: "queue" to let every running turn finish first. Message edits follow the same policy:
Message and interaction hooks expose the thread's session operations on ctx:
ctx.send() uses the Slack sender's auth unless you pass auth. Each operation returns a Delivery receipt. ctx.cancel() does nothing on an idle session and throws SessionNotActiveError on a thread without a session.
End a conversation
ctx.end({ reason? }) ends the thread's session, including any running turn. The next message starts a new session with fresh history, state, and sandbox:
await delivery.result()waits until the session has ended and the thread is free for a new one.- A thread without a session throws
SessionNotActiveError. - Return
nullafterctx.end()to treat the message as a command, or{ auth }to make it the first turn of the new session. onInteractiongets the same operations, so a New conversation button can end the session too.
Attachments
The agent receives the files attached to the message that reaches it. A mention without files also gets the files posted in the thread since the app's previous mention. A person can share a file and then ask about it.
- The lookback covers up to 10 messages back and up to 1,000 replies into the thread, and skips the app's own messages.
- DMs and threads the app answers without a mention get no lookback.
- Files shared from services such as Google Drive or Dropbox are links, not Slack files, so they stay in the message text.
- A download that fails or takes longer than 30 seconds reaches the model as a note.
- Voice clips reach the model as an audio file label, not sound. See Voice notes to transcribe them.
Images, PDFs, audio, video, and other files all reach the agent. See Inbound attachments for which files the model reads directly.
Private downloads use the session's app installation and need the files:read scope. Add it and reinstall the app before sending attachments. Downloads cover Slack's file hosts and URLs under api.fileBaseUrl, and use api.fetch when it's set. See File uploads for the fetchFile contract.
eve saves files in the session sandbox under /workspace/.eve/attachments, and history keeps only that path. If eve can't reattach the original sandbox, later turns get a missing-file result. Store files outside the sandbox when the agent must keep them.
Delivery
eve shows short work, such as reasoning and tool calls, in the thread status. It shows tasks in a task card. Replies post as ordinary messages.
| Moment | Thread status |
|---|---|
| A mention or DM arrives | Thinking..., while the message hook decides |
| The message hook drops the message | Cleared |
| The turn starts | Thinking... |
| The model reasons | Its latest reasoning heading, or its latest finished sentence |
| The model calls tools | Its narration before the calls, or the first action label, such as Search useEveAgent, plus +N more |
| A tool reports progress | The tool's label.delta text |
| A tool finishes | The tool's label.complete text, when it defines one |
| The model starts its next step | Reviewing researcher's results... after a task finishes, otherwise unchanged |
| The model streams a long reply | Writing a reply..., once the text passes 280 characters |
| The turn waits on its tasks | Waiting on researcher..., or Waiting on 3 tasks... |
| The turn waits on an approval, answer, or sign-in | Cleared until the turn resumes |
| A reply posts | Cleared by Slack |
- The status always names the latest work and doesn't fall back to
Thinking...between steps. - Each status stays up at least three seconds and is cut to 50 characters at a word boundary.
- Action labels skip
eve__task_waitandeve__task_cancel. They can include part of the call's input, such as a search query orbashcommand.
Slack clears a thread status after two minutes without a message from the app. A tool that runs longer than two minutes without reporting progress loses its status. Report progress with label.delta, or run the work as a task.
Replies up to 12,000 characters post inline. A longer reply uploads as an eve-response.md snippet, with a short note in the thread. eve also uploads a reply that Slack refuses as too large or malformed: msg_too_long, msg_blocks_too_long, msg_blocks_too_many, invalid_blocks, or invalid_blocks_format. Snippets need the files:write scope and keep any change a renderer made, such as a redaction. eve logs each fallback in a Slack refused the final reply warning, without the reply text.
The final reply can still fail: the upload fails, Slack returns another error, or a renderer throws. eve then posts this notice in the thread: I finished, but couldn't deliver my answer in Slack (error id ...). Please ask me to resend it.
- The error ID matches the
final reply was not delivered to Slackline in the Vercel runtime logs. - The notice carries no reply content. eve never re-sends the reply or retries the model.
- The next message tells the model its reply wasn't delivered.
- Other failed posts, such as status updates, are logged and skipped.
Text the model writes while its tasks keep working posts as its own message, and the reply after the results posts as another. A schedule's session posts only the final reply.
Outbound @name text stays literal. To mention a user, write <@USER_ID>, or call ctx.channel.thread.mentionUser(userId) in a renderer.
Approval and question cards show their prompt, tool input, and answer as literal text, so <!channel> or <url|label> in a model-written prompt shows as typed instead of notifying the channel or hiding a link. Card(...) text, fields, and subtitles are Slack mrkdwn, so mentions and links you write there render. Escape untrusted values you put in a card yourself: & as &, < as <, and > as >.
Task card
When a turn starts its first task, eve posts a task card in the thread. eve updates the card in place until the turn and its tasks finish. One task shows as a Slack task_card block; several show as a plan block with one row per task. Work inside a task, including the tasks it starts, adds no rows. The card needs only the chat:write scope. Schedule sessions and sessions without a Slack thread get no card.
Each row shows:
- Title: the tool's
label.start, or the tool name in words without its namespace, socrm__sync_accountsshows asSync accounts. A connection call shows asLinear: List issues. An agent task shows the agent name plus the first sentence of its brief, as inResearcher: Find the incidents behind the checkout spike. Setlabel.startfor exact casing, becausegithubshows asGithub. - Waiting:
Waiting for approval, or the matching text for an answer or sign-in. In a DM or private channel, the row also shows the request's prompt. - Done: the first sentence of the result, cut to about 100 characters. A task that ran a second or more adds its duration:
Done in 1m 14s: Found three incidents. - Failed:
Failed, orFailed after 3m. In a DM or private channel, the row adds the error's first sentence, as inFailed: Rate limited. - Stopped:
Stopped early since it was no longer neededwhen the model cancelled it witheve__task_cancel,Stopped by requestwhen the turn was cancelled,Stopped when the turn ended, orStopped. Only the model-cancelled row shows a success check.
The plan title summarizes the turn, from Working on 2 tasks and 1 of 2 tasks done to Finished 3 tasks in 5m 12s: 1 failed, 1 stopped. When every task calls one of at most three declared or remote agents, the title names them: Asking researcher and reviewer, then Waiting on reviewer · 1 of 2 tasks done. Tasks the model cancelled count as finished, not stopped.
- Messages sent while tasks work continue the same turn.
- If that turn starts a task after every task on its card has finished, eve finishes that card and posts a new one.
- A resumable task continued in a later turn appears in that turn's card.
- A failed card update never fails the turn, and eve posts a deleted card again on its next change.
Human-in-the-loop (HITL)
Approvals and questions show as Slack buttons and selects, and Type your answer opens a modal. Answers pass through onAnswers before the session resumes. Approval cards pair Deny with a primary Approve button.
A display: "select" question shows radio buttons for up to 6 options and a dropdown for more. Picking an option answers it. When the question sets initialOptionId, that option starts selected, and a primary Use button labeled with the option submits it, because Slack sends nothing when a person keeps the current selection. The button is one of eve's controls, so a custom interactionCard must keep it.
Set approvalChannel to choose where each request appears, including tool approvals and ctx.ask() questions:
| Value | Where the request appears |
|---|---|
"thread" | In the shared thread, for everyone. The default. |
"ephemeral" | In the thread, visible only to the Slack user who triggered the turn. |
"direct-message" | In that user's DM with the app. Needs the im:write scope. |
The callback receives the request (an Interaction) and the SessionContext. Omit it to keep every request in the thread. For "ephemeral" and "direct-message", the thread shows a Waiting on note naming the person instead of the request. If eve can't find the Slack user, it logs the request and posts nothing, so private requests fail closed. onAnswers or the tool's approval policy still decides who may answer.
Slack can't edit an ephemeral message after posting it, so an ephemeral card changes only when the person uses it. Their click replaces the card with eve's answered line, not an interactionCard rendering. If a policy refuses the answer, eve posts the card again. When the request ends without a click, only the thread note changes. Slack doesn't keep ephemeral messages across reloads, so use "direct-message" for a request the person may answer later.
Each approval, question, and budget prompt card updates as its request changes:
- Once eve accepts an answer, the card shows the answer and who gave it instead of the buttons, even while other requests from the same step wait. An approval card keeps the tool input it showed, as a record of what was approved. If a policy refuses the answer, the buttons come back.
- When several requests share one message, answering one updates only its part.
- Once the request ends, eve updates a private request's
Waiting onnote in the thread: an approval's note names the decision, and any other request's note says only who answered, so the answer stays private. - A request that ends without a click, such as when the person replies in the thread or the request is withdrawn, reads
No longer needed. - A click on a request whose session has ended marks the card
No longer active, and an ephemeral message tells the person to send a new message. A freeform answer submitted then replaces the whole message, including requests grouped with it.
To change how these cards look, use interactionCard.
A sign-in link or device code is a credential: whoever completes it connects their account to the session. So eve posts a status without the link in the thread. It sends the sign-in ephemerally to the Slack user it's for, and updates the status when the sign-in ends. The private prompt pairs a Connect button, labeled with the service name, with Cancel, which ends the waiting turn and updates the public status. When the session has no thread and isn't a code channel, a public status would post top-level in the channel, so eve sends the prompt to the person's DM instead, names the channel it's for, and edits the DM when the sign-in ends. If the DM can't be sent, eve posts in the channel as usual. To deliver a sign-in another way, see Render and decode HITL controls yourself.
Audience
Public channels are public; DMs, group DMs, and private channels are private. When an event doesn't say what kind of conversation it came from, eve asks Slack. It treats an unclear or failed lookup as private. The audience controls what traces capture, not who can use the channel. See Audience.
Options
slackChannel(config) takes these options. All are optional.
| Option | Default | Description |
|---|---|---|
credentials | SLACK_BOT_TOKEN and SLACK_SIGNING_SECRET | Bot token and inbound verification, from connectSlackCredentials(...) or { botToken, signingSecret, webhookVerifier }. |
route | /eve/v1/slack | Path for Events API, interactivity, and slash command requests. |
api | Slack's own hosts and the global fetch | { apiBaseUrl, fileBaseUrl, fetch }. See Point the channel at a different Slack API host. |
botName | The channel name, cut to 35 characters | App name in the generated Slack app manifest. |
turnPolicy | "steer" | "steer" or "queue". See Control overlapping turns. |
messageContext | Off | { users } adds sender names, and emails with email: true, to model context. See Add sender names and emails. |
threadContext | Off | Load earlier thread replies. {} means since: "thread-root". See Load prior thread messages. |
codeChannels | false | Serve Slack code channels as one session each. See Serve Slack code channels. |
uploadPolicy | Any media type, up to 25 MB | "disabled" or { maxBytes, allowedMediaTypes } for inbound files. |
approvalChannel | "thread" | (request, ctx) => "thread" | "ephemeral" | "direct-message". See Human-in-the-loop. |
renderers | eve's default renderer | Renderers that wrap eve's default. See Customize rendering. |
onAppMention | Dispatch with workspace-scoped auth | (ctx, message) hook for app_mention events. |
onDirectMessage | Dispatch with workspace-scoped auth | (ctx, message) hook for DMs. |
onMessage | None | (ctx, message) hook for other posted messages. See Message hooks. |
onMessageEdited | Run the message hook a new message of the same kind reaches | (ctx, edit) hook for message edits. See Message edits. |
onAnswers | Accept with ctx.defaultAuth | (ctx, submission) hook that authorizes HITL answers. |
onEvent | None | (ctx, event) hook for other Events API callbacks. See Other Events API callbacks. |
onInteraction | None | (action, ctx) hook for your own block_actions callbacks. |
onShortcut | None | (shortcut, ctx) hook for message and global shortcuts. |
onSlashCommand | None | (command, ctx) hook for slash commands. |
The channel mounts POST /eve/v1/slack. It reads SLACK_BOT_TOKEN when credentials has no bot token, and SLACK_SIGNING_SECRET when it has neither a signing secret nor a webhookVerifier.
Advanced use
Serve Slack code channels
A Slack code channel is a Slack channel dedicated to one agent task. With codeChannels: true, people work with the agent in the channel without mentioning it. Every message reaches the agent, the whole channel shares one conversation, Slack shows whether the agent is working or waiting on someone, and anyone can stop it from Slack:
Code channels need extra Slack app permissions. With codeChannels set, the generated app manifest includes them. With Vercel Connect, turn on Code Channels in the connector's settings, which adds the code_channels:manage scope and the message.session and agent_session_stopped events. Then add groups:read and mpim:read under Bot Scopes.
Without codeChannels, eve treats a code channel like any other channel.
Open a code channel from a thread
You can give the agent a tool that calls openCodeChannel() so it can move multi-step work out of a thread. The new code channel starts with the conversation so far, and the original thread stays available for quick follow-ups:
- Slack links the new channel in the original thread and invites the person who asked. A private conversation opens a private code channel.
- Omit
nameto let Slack name the channel from the message. - Outside Slack or inside a code channel,
openCodeChannel()returns{ status: "unavailable", reason }and the model continues in the thread. - When Slack refuses, such as for a Slack Connect conversation, disabled code channels, or a missing scope, it throws Slack's error for the model to relay.
- Like every
ctx.to(), it works only in a tool on the root agent.
For full control, skip the helper and send to the Slack channel with a codeChannel target. codeChannel takes the origin message's originTs, its thread's originThreadTs, and an optional name. Pass history to start the session with earlier messages:
A route, schedule, or onEvent handler can open a code channel the same way, from any message the app can see.
Open a code channel from a message hook
To open a code channel on every request without the model deciding, call ctx.openCodeChannel() in onAppMention, onDirectMessage, or onMessage. Send the first message to the returned session and return null so the original thread doesn't also answer:
ctx.openCodeChannel() copies no conversation by default. Pass history to send to include earlier messages. It throws without codeChannels: true, inside a code channel, and when Slack refuses to create the channel.
How eve serves code channels
- Replies. The agent replies top-level, or in a thread when someone writes in one. Any member can message it.
- Status. Slack shows
processingwhile the agent works,suspendedwhile it waits on a person, andactiveotherwise. Stopping the session in Slack cancels the running turn. - Hooks. Messages without a mention go to
onMessage, elseonAppMention, else the default handler, so mention filters apply in code channels too. Checkctx.slack.codeChannel, orchannel.state.codeChannelin renderers, to tell code channel messages apart. - Proactive sends. Target a code channel's session with
{ channelId, codeChannel: true }orslackCodeChannelContinuationToken(channelId). - Channels opened from Slack. A code channel opened from Slack's UI starts without the original conversation. Open it with
openCodeChannel()to carry the conversation over. - Repeat opens. Each person gets one code channel per message, so a retried tool call reaches the same channel.
- Detection. If eve can't look the channel up with Slack's
conversations.info, it serves the channel per thread and retries a minute later.
Other Events API callbacks
onEvent(ctx, event) receives raw Slack events that no message hook handles, such as reaction_added, team_join, or channel_created. Call ctx.send(message, { target, auth, ...options }) any number of times to start turns. It takes the same options as to().send():
titlesets the run title without changing the message.historyadds prior conversation; see Start from prior history.idempotencyKeymakes a retried send reach the same session once.- Each call returns a receipt with the
sessionId.
The webhook request stays open while an awaited handler runs; use ctx.waitUntil(promise) for work that runs after it. ctx.slack.request(operation, body) calls the Slack Web API, and ctx.envelope carries team_id, event_id, and event_time.
An event isn't tied to one thread, so pass the target to each operation:
A code channel's session spans all its threads. Target it with { channelId, codeChannel: true } in every operation except send.
onEvent receives JSON event_callback requests only, not URL verification, slash commands, or interactive payloads. Add each event and its OAuth scope to the Slack app's Event Subscriptions.
Cards
Build typed message layouts with the card builders from eve/channels/slack, or pass raw Slack blocks as { blocks, text }. Cards are plain data, not JSX components.
| Builders | Use |
|---|---|
Card, CardText, CardLink | Build a card with text and links. |
Section, Divider, Image | Group content, separate it, or add an image. |
Fields, Field, Table | Display labeled values or tabular data. |
Actions, Button, LinkButton | Group action buttons and links. |
Select, SelectOption, RadioSelect | Add fixed-choice controls inside Actions. |
For example, post a review link from a message hook:
- Handle your own button and select callbacks in
onInteraction. For eve's approval and question controls, use the HITL helpers. thread.post({ card })converts the card withcardToBlocks(card), and withcardToFallbackText(card)unless you passfallbackText.- Message cards don't support modals, text inputs, or external selects. For a custom modal, send native Slack view data with
ctx.slack.request("views.open", ...).
Proactive sessions
Start a Slack conversation from a webhook on another channel, a schedule, or a tool. To copy a conversation into a new thread or someone's DMs, see Fork conversations into a new thread. Pass { channelId } as the target to start a new thread whose first message is the agent's first post. Optional target fields:
| Field | Use |
|---|---|
threadTs | Continue an existing thread. |
initialMessage | Post a thread root before the agent runs: { markdown }, { text }, { blocks, text? }, or { card, fallbackText? }. Not with threadTs or codeChannel. |
installationTeamId | Select the app installation workspace for a function-form bot token. |
codeChannel | Open a code channel from a message in channelId and start the session there. Needs codeChannels: true. |
audience | Set the destination's visibility. Defaults to unknown. |
A send with an idempotencyKey and no threadTs or initialMessage picks the new thread's session from the key. A retry with the same key then reaches the same session instead of starting a second thread. Two different sends that reuse a key land in the same thread, and the second is ignored. Use a key that identifies the message across every sender to this channel, not only across retries of one sender.
initialMessage takes the same inputs as thread.post, including cards and optional files. eve posts the root message, then uploads files into its thread. A retried proactive send repeats the root post and its uploads, so don't use it as an exactly-once notification. For example, start a thread with a Markdown root:
The agent's replies appear under the root. Teammates continue the session by mentioning the app in the thread. To accept replies without a mention, configure onMessage and its subscriptions.
To post without an agent turn, use ctx.thread.post(...) in an inbound handler, ctx.channel.thread.post(...) in a renderer, or callSlackApi(...) elsewhere.
Slack API calls outside a handler
Inbound handlers call the Slack Web API with ctx.slack.request(operation, body), and a renderer's event handlers use ctx.channel.slack.request(...). Elsewhere, such as in a schedule, call callSlackApi:
callSlackApipassescontextto a function-form token.- It form-encodes the body, because some methods, such as
conversations.replies, reject JSON. - It takes the same
apioption as the channel. Anundefinedbase keeps Slack's own hosts. resolveSlackBotTokenreturns the bearer token as a string.
Point the channel at a different Slack API host
| Field | Default | What it does |
|---|---|---|
apiBaseUrl | https://slack.com/api/ | The base that Web API method names resolve against. |
fileBaseUrl | apiBaseUrl | A host whose file downloads get the bot token, alongside files.slack.com and Enterprise Grid file URLs. |
fetch | Global fetch | Carries requests to the configured bases' origins only. With no base set, it carries all Slack traffic, as for a test. |
Other public https: file URLs download without the token. Both bases must be absolute http: or https: URLs without a query string or fragment, or slackChannel() throws. A missing trailing slash is added. A header that api.fetch adds, such as the simulator's bypass secret above, never reaches files.slack.com or other hosts Slack names.
Customize rendering
Pass renderers to change what the agent posts. Each renderer wraps the ones after it, ending with eve's default renderer. A renderer has four optional parts:
received(message, channel, next)acknowledges a mention or DM when it arrives, and another message onceonMessageaccepts it. eve's default setsThinking....eventshandles session events such ascontent.completedorinteraction.opened. Each handler receives(event, ctx, next). The event hastype,data, andscope(the turn or call it belongs to). The context hasctx.channel.thread,ctx.channel.slack,ctx.position, andctx.view.call.inputstreams a tool call's arguments as the model writes them, so a renderer can show a draft before the call runs; eve's default ignores it.taskCard(view, next)returns the task card's blocks and notification text, ornullfor no card.interactionCard(card, next)returns the messages for one approval, question, or budget prompt.
Call next() to run the rest of the chain, before or after your own work. You can also pass it a changed event, as in next({ ...event, data: { ...event.data, value } }). The rest of the chain runs at most once. Skip next to replace the default. This renderer adds feedback buttons below each final reply and a note to the finished task card:
onInteraction receives clicks on buttons a renderer posts, such as the feedback buttons above.
A content.completed handler that posts the reply itself, instead of calling next(), is responsible for that reply. If it throws, eve logs the error, posts the delivery notice, and tells the model, but doesn't re-send your reply. If you post a follow-up after the reply, as the example above does, catch the follow-up's errors. Otherwise eve posts the notice even though the reply arrived.
To keep eve's fallbacks for a reply you render, post it with postCompletedSlackReply. eve tries, in order:
- Your
blocks, when given, withtextas the notification text.textdefaults tomarkdown. - Your
markdownas one native Markdown message, when it fits in 12,000 characters. eve tries it when you gave no blocks or Slack refused them as too large or malformed. - Your
markdownas theeve-response.mdsnippet, when it's longer or Slack refuses the Markdown message.
Other errors, including a failed upload, go to your handler; if your handler doesn't catch them, eve posts the notice. Slack caps the combined text of all markdown blocks in one message at 12,000 characters. A reply that fits in markdown_text can still be refused as blocks.
Pass a string, as in postCompletedSlackReply(ctx.channel, reply), to post Markdown alone, as eve's default does.
taskCard runs for every turn that calls a tool, including a turn without tasks. It receives:
calls: the turn's tool calls on this card asCallObservationvalues that you can't change, in call order. A call that started a task has ataskId. eve leaves out its own task controls and calls a tool makes for the model.view: a snapshot of the session. Read it with the selectors fromeve/events:callState(view, callId)returnsrunning,blocked,completed,cancelled, and other states.callLabel(row)returns the row title.openInteractions(view, { about: { callId } })returns the open approvals, questions, and sign-ins holding a call up.
state:blockedwhile any task waits on an approval, question, or sign-in,workingwhile the turn or any task works, thenfinished.audience: who reads the card. eve's default shows errors and request prompts only when it'sprivate; do the same with what you show fromcalls.
taskCard must be synchronous and have no side effects; eve posts and updates the card. eve's default returns null for a card without tasks. Its block keeps one block_id for the whole turn, so keep that block_id on a block you build in its place. To change a row's title in every channel, give the tool a label instead.
A renderer's interaction.opened handler can add to how a request appears, then call next() for eve's controls. This one posts non-sensitive context in the thread first, while approvalChannel still sends sensitive reviews to a DM:
Restyle approval and question cards
interactionCard(card, next) restyles the card for one approval, question, or budget prompt. It doesn't run for sign-ins. card holds:
| Field | What it is |
|---|---|
interaction | The request, with its status, outcome, call (including the tool input), and answer. While the request is open, answer is the latest accepted answer, if any. Once it ends, answer is the one that decided it. |
destination | "thread", "ephemeral", or "direct-message", as approvalChannel decided. In a code channel, "thread" is the code channel itself. |
audience | Who reads the message. An ephemeral or direct-message request is always private; a thread request has the thread's audience. |
answeredBy | The Slack user ID whose answer stands or decided the request, when known. |
view | The session snapshot, for the selectors from eve/events. |
It returns controls, the message with eve's buttons or select, and an optional details message that eve posts before the controls. Each is a SlackCardMessage with blocks and text, the shape taskCard returns. Slack sends the whole controls message back with every click, so put long content in details. eve's default approval card keeps the tool input it shows short: up to 10 top-level fields, 500 characters per value, and 1,500 characters in all. Requests asked together share one details message, which eve deletes once its last open request ends. This renderer shows a plan-create tool's steps as the approval's details:
eve calls interactionCard when a request opens, when an answer is accepted or refused, and when the request ends. It updates the Slack message only when its blocks changed. Pass next a changed card, such as one with a shorter interaction.request.prompt, to have eve's default render it.
eve still routes, groups, and posts the messages, and owns the controls' action IDs, so clicks keep reaching the session. You can relabel, reorder, or nest eve's controls within these rules:
- While the request is open and unanswered,
controlsholds exactly the controlsnextrenders, each once, with the same values. Every eve control'saction_idstarts witheve_input:oreve_input_freeform:. - Once the request is answered or ended,
controlsholds no eve controls. detailsnever holds eve controls.- A message holds at most 50 blocks, including requests eve grouped with yours. An update over that limit uses eve's default for the changed request, then only the block with eve's controls, so an open request always shows them.
If interactionCard throws or breaks these rules, eve logs it and renders that request with its default, because a request nobody can answer would hold the turn. If Slack refuses a message's content, such as with invalid_blocks or msg_too_long, eve sends it once more with its defaults. eve doesn't resend after other failures, such as a timeout or rate_limited, because the first message may have posted.
Show your own tool on the task card
A renderer can draw any of the turn's tool calls from their input. This plan tool records a checklist, and the renderer shows it ahead of eve's task rows:
Render and decode HITL controls yourself
renderInteractionBlocks(request, route?) returns eve's Block Kit blocks for one request (Interaction). answerFromSlackAction(action) decodes a click on them into { response, kind?, route? }, where response is the eve Answer. It returns null for any other action. Every eve control's action_id starts with ANSWER_ACTION_PREFIX ("eve_input:"), so give your own buttons a different prefix to route them to onInteraction.
Use them to test a custom renderer against eve's Slack payloads, or to post eve's controls from your own renderer. To restyle the cards eve posts, use interactionCard instead, which keeps eve's batching and card updates.
- A click on these controls in the session's thread resumes the session through
onAnswers. - eve doesn't track controls you post, so update or remove them in your renderer's
interaction.settledhandler. - To pass
responsetorespond()yourself, validate it withparseAnswersfromeve/client.
For a sign-in, a renderer's handler gets a private-only ctx.channel with postEphemeral, postDirectMessage, and state. It gets no public post or raw API access. postDirectMessage needs the im:write scope.
audience.principalIds lists the eve identities (principalId values) of the people the sign-in is for. state.slackUsersByPrincipal maps each identity seen in the thread to its Slack user ID. An identity without an entry gets no private sign-in. Skip next() to deliver the sign-in yourself:
Test a preview branch
Create a second connector for preview traffic and route it to your preview branch:
Then select the connector at runtime:
In the Connect dashboard:
- Remove the production destination that
connect create --triggersadds, so preview traffic stays separate. - Set the production connector's project access to Production and the preview connector's to Preview, because guided setup doesn't restrict credential environments.
A connector can have at most three trigger destinations.
Slack must reach the preview route without an authentication challenge. For a Connect trigger, exempt the branch domain with a Deployment Protection Exception or use an unprotected domain. For a self-managed Slack app, append ?x-vercel-protection-bypass=your-generated-secret to its event and interaction Request URLs. Slack doesn't send the automation bypass header.
Troubleshoot Slack delivery
| What you see | What to do |
|---|---|
eve add channel/slack stops before finishing | Fix the step the error names, then rerun eve add channel/slack. |
| Setup says the Slack app isn't installed in a workspace | Rerun eve add channel/slack, then finish the install in the browser page it opens while setup waits. |
| Setup says a connector is used by another project | Let setup create a new Slack app, or remove the existing app from the other project in the Connect dashboard first. |
| Setup says the connector has too many destinations | Remove an unused destination in the Connect dashboard, then rerun setup. |
| Mentions never reach the deployment | Rerun eve add channel/slack to repair the production destination, and check branch destinations in the Connect dashboard. |
| A preview request receives an authentication page | Exempt the branch domain from Deployment Protection, or add the bypass secret to a self-managed app's Request URLs. |
| Mentions work but DMs or thread replies don't | Add message.im and im:history for DMs, or the matching message event and history scope for channel replies, then reinstall the app. |
| A long response can't be uploaded as a snippet | Add the files:write bot scope and reinstall the app. |
| The thread says the agent couldn't deliver its answer | Search the Vercel runtime logs for the notice's error id on the final reply was not delivered to Slack line. |
| The webhook arrives but the agent doesn't reply | Check the Vercel runtime logs, then the session in Agent Runs when your team has access. |
What to read next
- Channels overview: the channel contract and every built-in channel
- Auth & route protection: authenticating inbound traffic
- Chat SDK adapters: use a Chat SDK Slack adapter and runtime instead of eve's Slack integration