← Back to PRs

#9954: feat(slack): add Agents & AI Apps (assistant) support

by natedenh open 2026-02-05 22:47 View on GitHub →
docs channel: slack stale
## Summary Adds support for Slack's "Agents & AI Apps" feature, enabling the full assistant experience when the toggle is enabled in Slack app settings. ## What this does When a Slack app has "Agents & AI Apps" enabled, Slack fires special assistant events and provides a split-view side panel for AI conversations. This PR handles those events: ### New: `assistant_thread_started` handler - Fired when a user opens the AI assistant panel or starts a new thread - Sets configurable suggested prompts ("How can I help?", "Summarize channel", etc.) - Stores thread context (which channel the user is viewing) for channel-aware responses ### New: `assistant_thread_context_changed` handler - Fired when a user switches channels while the assistant panel is open - Updates stored thread context ### New: Auto thread titles - After the first reply in an assistant thread, automatically sets the thread title (truncated user message) - Shown in Slack's History tab for easy conversation navigation ### New: Thread context store - In-memory store tracking assistant thread context (channel, team, enterprise) - TTL-based cleanup (24h expiry) to prevent memory growth ## Backward compatible All listeners are registered but only fire when "Agents & AI Apps" is enabled in the Slack app settings. **Zero impact when the toggle is OFF.** ## Files changed | File | Change | |------|--------| | `src/slack/monitor/events/assistant.ts` | New — assistant event handlers | | `src/slack/monitor/assistant-context.ts` | New — thread context store | | `src/slack/monitor/events.ts` | Register assistant events | | `src/slack/monitor/message-handler/dispatch.ts` | Auto-title assistant threads | | `docs/channels/slack.md` | Add `assistant:write` scope + events to manifest | ## Slack setup required 1. Enable "Agents & AI Apps" in Slack app settings 2. Add `assistant:write` to bot scopes 3. Subscribe to `assistant_thread_started` and `assistant_thread_context_changed` events ## Future work (not in this PR) - Text streaming (`chat.startStream` / `appendStream` / `stopStream`) - Configurable suggested prompts via `channels.slack.assistant` config - Context-aware prompts (different prompts per channel) - Feedback buttons on responses <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR adds support for Slack “Agents & AI Apps” assistant events by registering new event listeners (`assistant_thread_started`, `assistant_thread_context_changed`), maintaining an in-memory per-assistant-thread context store (TTL-based), and auto-setting thread titles after the first response. It wires the new assistant event registration into the existing Slack monitor event registration, and updates Slack setup docs/manifest to include the required `assistant:write` scope and assistant events. <h3>Confidence Score: 4/5</h3> - This PR is likely safe to merge, but has a couple logic issues that will cause incorrect behavior in Slack assistant threads. - The changes are scoped to new Slack assistant events and a small dispatch hook; however, thread titling uses the wrong timestamp for new threads and context expiration cleanup may not run without writes, which can lead to unbounded memory growth over long uptimes. - src/slack/monitor/message-handler/dispatch.ts, src/slack/monitor/assistant-context.ts <!-- greptile_other_comments_section --> <sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub> <!-- /greptile_comment -->

Most Similar PRs