Skip to content

Commit 7fa0424

Browse files
feat(slack): add agent sessions and streaming
1 parent f41e27a commit 7fa0424

34 files changed

Lines changed: 2707 additions & 157 deletions

File tree

‎apps/docs/content/docs/integrations/slack.mdx‎

Lines changed: 127 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Slack
3-
description: Send, update, delete messages, manage views and modals, add or remove reactions, manage canvases, get channel info and user presence in Slack
3+
description: Send and manage Slack messages, Agent Sessions, streamed replies, views, reactions, conversations, and canvases
44
---
55

66
import { BlockInfoCard } from "@/components/ui/block-info-card"
@@ -24,6 +24,7 @@ With the Slack integration in Sim, you can:
2424
- **Read messages**: Retrieve recent messages from channels or DMs, with filtering by time range
2525
- **Manage channels and users**: List channels, members, and users in your Slack workspace
2626
- **Download files**: Retrieve files shared in Slack channels for processing within a workflow
27+
- **Build Slack agents**: Manage Agent Sessions, stream replies, handle stop/title/context events, and configure Agent View actions and suggested prompts for custom bots
2728

2829
In Sim, the Slack integration enables your agents to programmatically interact with Slack as part of their workflows. This allows for automation scenarios such as sending notifications with dynamic updates, managing conversational flows with editable status messages, acknowledging important messages with reactions, and maintaining clean channels by removing outdated bot messages. The integration can also be used in trigger mode to start a workflow when a message is sent to a channel.
2930

@@ -39,7 +40,7 @@ If you encounter issues with the Slack integration, contact us at [help@sim.ai](
3940

4041
## Usage Instructions
4142

42-
Integrate Slack into the workflow. Can send, update, and delete messages, send ephemeral messages visible only to a specific user, open/update/push modal views, publish Home tab views, create canvases, read messages, and add or remove reactions. Requires Bot Token instead of OAuth in advanced mode. Can be used in trigger mode to trigger a workflow when a message is sent to a channel.
43+
Integrate Slack messaging and administration into a workflow. Custom Slack bots can manage Agent Sessions, stream incremental Markdown or structured chunks, react to Agent Session events, and configure Agent View suggested prompts. Standard messaging and management operations support both the Sim app and custom bot credentials.
4344

4445

4546

@@ -802,73 +803,159 @@ Get a stable permalink URL to a specific Slack message.
802803
| `channel` | string | Channel ID containing the message |
803804
| `permalink` | string | The permalink URL to the message |
804805

805-
### Slack Set Assistant Status
806+
### Slack Set Agent Suggested Prompts
806807

807-
Set or clear the assistant thread status indicator (the loading shimmer) on a Slack AI app thread. Pass an empty status to clear it.
808+
Set suggested prompts in Slack Agent View, optionally scoped to a specific thread.
808809

809810
#### Input
810811

811812
| Parameter | Type | Required | Description |
812813
| --------- | ---- | -------- | ----------- |
813-
| `authMethod` | string | No | Authentication method: oauth or bot_token |
814-
| `botToken` | string | No | Bot token for Custom Bot |
815-
| `channel` | string | Yes | Channel ID containing the assistant thread \(e.g., C1234567890 or D1234567890\) |
816-
| `threadTs` | string | Yes | Thread timestamp \(thread_ts\) of the assistant thread \(e.g., 1405894322.002768\) |
817-
| `status` | string | No | Status text to display, e.g. 'Working on it…'. Omit or pass an empty string to clear the status. |
818-
| `loadingMessages` | json | No | Optional list of messages to rotate through as an animated loading indicator \(max 10\). |
814+
| `authMethod` | string | No | Slack authentication method |
815+
| `botToken` | string | No | Custom Slack bot token |
816+
| `channel` | string | Yes | Agent direct-message channel ID |
817+
| `threadTs` | string | No | Optional thread timestamp for legacy thread-scoped prompts |
818+
| `prompts` | json | Yes | One to four prompt objects with title and message fields |
819+
| `promptsTitle` | string | No | Optional heading displayed above the prompt chips |
819820

820821
#### Output
821822

822823
| Parameter | Type | Description |
823824
| --------- | ---- | ----------- |
824-
| `ok` | boolean | Whether the status was set successfully |
825-
| `channel` | string | Channel ID the status was set on |
826-
| `threadTs` | string | Thread timestamp the status was set on |
825+
| `ok` | boolean | Whether Slack updated the suggested prompts |
827826

828-
### Slack Set Assistant Title
827+
### Slack Set Agent Session Status
829828

830-
Set the title of a Slack assistant thread (shown in the AI app thread header).
829+
Create or update the state of a Slack agent session associated with a thread.
831830

832831
#### Input
833832

834833
| Parameter | Type | Required | Description |
835834
| --------- | ---- | -------- | ----------- |
836-
| `authMethod` | string | No | Authentication method: oauth or bot_token |
837-
| `botToken` | string | No | Bot token for Custom Bot |
838-
| `channel` | string | Yes | Channel ID containing the assistant thread \(e.g., C1234567890 or D1234567890\) |
839-
| `threadTs` | string | Yes | Thread timestamp \(thread_ts\) of the assistant thread \(e.g., 1405894322.002768\) |
840-
| `title` | string | Yes | The title to display for the assistant thread |
835+
| `authMethod` | string | No | Slack authentication method |
836+
| `botToken` | string | No | Custom Slack bot token |
837+
| `channel` | string | Yes | Channel ID containing the agent session thread |
838+
| `threadTs` | string | Yes | Timestamp of the thread associated with the agent session |
839+
| `status` | string | Yes | Agent session state: active, processing, suspended, or closed |
840+
| `title` | string | No | Title used when creating the agent session, up to 200 characters |
841+
| `initiatorUserId` | string | No | Slack user ID that initiated the session |
842+
| `iconEmoji` | string | No | Emoji used to customize the agent identity |
843+
| `iconUrl` | string | No | Image URL used to customize the agent identity |
844+
| `username` | string | No | Display name used to customize the agent identity |
841845

842846
#### Output
843847

844848
| Parameter | Type | Description |
845849
| --------- | ---- | ----------- |
846-
| `ok` | boolean | Whether the title was set successfully |
847-
| `channel` | string | Channel ID the title was set on |
848-
| `threadTs` | string | Thread timestamp the title was set on |
850+
| `ok` | boolean | Whether Slack updated the agent session |
851+
| `status` | string | Requested agent session status |
852+
| `agentStatus` | string | Agent status recorded by Slack |
853+
| `title` | string | Current agent session title |
849854

850-
### Slack Set Suggested Prompts
855+
### Slack Rename Agent Session
851856

852-
Set the clickable suggested prompts shown in a Slack assistant thread (the prompt chips in an AI app).
857+
Rename the Slack agent session associated with a thread.
853858

854859
#### Input
855860

856861
| Parameter | Type | Required | Description |
857862
| --------- | ---- | -------- | ----------- |
858-
| `authMethod` | string | No | Authentication method: oauth or bot_token |
859-
| `botToken` | string | No | Bot token for Custom Bot |
860-
| `channel` | string | Yes | Channel ID containing the assistant thread \(e.g., C1234567890 or D1234567890\) |
861-
| `threadTs` | string | Yes | Thread timestamp \(thread_ts\) of the assistant thread \(e.g., 1405894322.002768\) |
862-
| `prompts` | json | Yes | Array of prompts, each with a "title" \(shown on the chip\) and a "message" \(sent when clicked\). Max 4. |
863-
| `promptsTitle` | string | No | Optional heading for the prompt list, e.g. 'Suggested Prompts' |
863+
| `authMethod` | string | No | Slack authentication method |
864+
| `botToken` | string | No | Custom Slack bot token |
865+
| `channel` | string | Yes | Channel ID containing the agent session thread |
866+
| `threadTs` | string | Yes | Timestamp of the thread associated with the agent session |
867+
| `title` | string | Yes | New agent session title, from 1 to 200 characters |
868+
869+
#### Output
870+
871+
| Parameter | Type | Description |
872+
| --------- | ---- | ----------- |
873+
| `ok` | boolean | Whether Slack renamed the agent session |
874+
| `title` | string | Updated agent session title |
875+
876+
### Slack Start Stream
877+
878+
Start a streaming Slack message using Markdown or structured chunks.
879+
880+
#### Input
881+
882+
| Parameter | Type | Required | Description |
883+
| --------- | ---- | -------- | ----------- |
884+
| `authMethod` | string | No | Slack authentication method |
885+
| `botToken` | string | No | Custom Slack bot token |
886+
| `channel` | string | Yes | Channel ID where Slack should create the streaming message |
887+
| `markdownText` | string | No | Initial Markdown content, mutually exclusive with chunks |
888+
| `chunks` | json | No | Initial structured Slack streaming chunks, mutually exclusive with Markdown |
889+
| `threadTs` | string | No | Parent thread timestamp when streaming a reply |
890+
| `recipientUserId` | string | No | Recipient user ID for a channel stream |
891+
| `recipientTeamId` | string | No | Recipient workspace ID for a channel stream |
892+
| `taskDisplayMode` | string | No | Task display mode: timeline or plan |
893+
| `iconEmoji` | string | No | Emoji used to customize the streaming agent identity |
894+
| `iconUrl` | string | No | Image URL used to customize the streaming agent identity |
895+
| `username` | string | No | Display name used to customize the streaming agent identity |
896+
897+
#### Output
898+
899+
| Parameter | Type | Description |
900+
| --------- | ---- | ----------- |
901+
| `ok` | boolean | Whether Slack started the stream |
902+
| `channel` | string | Channel containing the streaming message |
903+
| `ts` | string | Timestamp used to append to or stop the stream |
904+
905+
### Slack Append Stream
906+
907+
Append Markdown or structured chunks to an active Slack stream.
908+
909+
#### Input
910+
911+
| Parameter | Type | Required | Description |
912+
| --------- | ---- | -------- | ----------- |
913+
| `authMethod` | string | No | Slack authentication method |
914+
| `botToken` | string | No | Custom Slack bot token |
915+
| `channel` | string | Yes | Channel containing the streaming message |
916+
| `ts` | string | Yes | Timestamp returned by Start Stream |
917+
| `markdownText` | string | No | Markdown content to append, mutually exclusive with chunks |
918+
| `chunks` | json | No | Structured Slack streaming chunks, mutually exclusive with Markdown |
919+
920+
#### Output
921+
922+
| Parameter | Type | Description |
923+
| --------- | ---- | ----------- |
924+
| `ok` | boolean | Whether Slack appended the stream content |
925+
| `channel` | string | Channel containing the streaming message |
926+
| `ts` | string | Streaming message timestamp |
927+
928+
### Slack Stop Stream
929+
930+
Finalize an active Slack stream and return the resulting message.
931+
932+
#### Input
933+
934+
| Parameter | Type | Required | Description |
935+
| --------- | ---- | -------- | ----------- |
936+
| `authMethod` | string | No | Slack authentication method |
937+
| `botToken` | string | No | Custom Slack bot token |
938+
| `channel` | string | Yes | Channel containing the streaming message |
939+
| `ts` | string | Yes | Timestamp returned by Start Stream |
940+
| `markdownText` | string | No | Final Markdown content, mutually exclusive with chunks |
941+
| `chunks` | json | No | Final structured Slack chunks, mutually exclusive with Markdown |
942+
| `blocks` | json | No | Final Block Kit blocks, as an array of up to 50 block objects |
943+
| `metadata` | json | No | Message metadata containing event_type and event_payload |
944+
| `sessionStatus` | string | No | Final agent session state: active, processing, suspended, or closed |
864945

865946
#### Output
866947

867948
| Parameter | Type | Description |
868949
| --------- | ---- | ----------- |
869-
| `ok` | boolean | Whether the suggested prompts were set successfully |
870-
| `channel` | string | Channel ID the prompts were set on |
871-
| `threadTs` | string | Thread timestamp the prompts were set on |
950+
| `ok` | boolean | Whether Slack finalized the stream |
951+
| `channel` | string | Channel containing the finalized message |
952+
| `ts` | string | Finalized streaming message timestamp |
953+
| `message` | object | Final Slack message returned by chat.stopStream |
954+
| ↳ `text` | string | Final message text |
955+
| ↳ `bot_id` | string | Bot ID |
956+
| ↳ `ts` | string | Message timestamp |
957+
| ↳ `type` | string | Message type |
958+
| ↳ `subtype` | string | Message subtype |
872959

873960
### Slack List Channels
874961

@@ -1909,7 +1996,13 @@ Trigger from Slack events (mentions, messages, reactions)
19091996
| ↳ `text` | string | Message text content. For slash commands, the text after the command. For interactivity, the source message text \(falls back to the triggering action value\) |
19101997
| ↳ `timestamp` | string | Message timestamp from the triggering event |
19111998
| ↳ `thread_ts` | string | Parent thread timestamp \(if message is in a thread\) |
1999+
| ↳ `streaming_message_ts` | array | Message timestamps streamed during a stopped agent session |
2000+
| ↳ `title` | string | Current agent session title |
2001+
| ↳ `previous_title` | string | Previous agent session title |
2002+
| ↳ `tab` | string | App Home tab that was opened, including messages for Agent View |
2003+
| ↳ `context` | json | Current Agent View context. Normalized from context on app_context_changed/app_home_opened or app_context on message.im |
19122004
| ↳ `team_id` | string | Slack workspace/team ID |
2005+
| ↳ `enterprise_id` | string | Slack Enterprise Grid organization ID |
19132006
| ↳ `event_id` | string | Unique event identifier |
19142007
| ↳ `reaction` | string | Emoji reaction name \(e.g., thumbsup\). Present for reaction_added/reaction_removed events |
19152008
| ↳ `item_user` | string | User ID of the original message author. Present for reaction_added/reaction_removed events |

0 commit comments

Comments
 (0)