Tip: How Does the Slack Entrypoint Work in Solace Agent Mesh?

Tip: How Does the Slack Entrypoint Work in Solace Agent Mesh?

Solace Agent Mesh is an event-driven framework for building distributed ecosystems of collaborative AI agents, powered by the Solace Event Mesh for enterprise-grade agent orchestration. Agents do the thinking. But to bring them into the conversations your team is already having, you need a chat integration. That is what the Slack Entrypoint provides.

The Slack Entrypoint is a plugin that connects your agent mesh to Slack workspaces through Socket Mode. Users interact with agents by messaging or mentioning a bot. Agents respond in threads with streaming updates, file attachments, and feedback collection. No public endpoint required.

In this post, we will walk through how the Slack Entrypoint works, how to install and configure it, the features it supports, and the key concepts you need to know when integrating your agent mesh with Slack. A video walkthrough of the full setup process is included below.

How It Works

The Slack Entrypoint uses the Gateway Adapter pattern, the recommended approach for building entrypoints in Solace Agent Mesh. It is built on slack_bolt, Slack’s official Python framework, using Socket Mode.

Socket Mode means the entrypoint connects outbound to Slack’s servers over a WebSocket. No public URL needed. No webhook endpoints to expose. No SSL certificates to manage. It works behind your firewall without any network configuration.

The flow is:

  1. A user sends a message or mentions the bot in a Slack channel

  2. The adapter picks up the event via Socket Mode

  3. It converts the message into an A2A task and publishes it to the Solace event broker

  4. Agents process the task and stream results back

  5. The adapter posts the agent’s response in the Slack thread

The entrypoint itself makes no LLM calls. It is a transport layer between Slack and the agent mesh.


Installation and Slack App Setup

Install the Slack Entrypoint plugin:


sam plugin add my-slack --plugin sam-slack-gateway-adapter

This creates a configuration file at configs/gateways/my-slack.yaml. Before starting, you need a Slack app with Socket Mode enabled, the right OAuth scopes, and event subscriptions configured.

The setup involves creating an app at api.slack.com/apps, enabling Socket Mode to get an App Token (xapp-...), adding bot scopes, installing the app to get a Bot Token (xoxb-...), and subscribing to events. The video walkthrough below demonstrates each step in detail.

For the full step-by-step setup instructions, see the official documentation:

Required Bot Token Scopes

Your Slack app needs all of the following scopes under OAuth & Permissions > Bot Token Scopes:

Scope Purpose
chat:write Post messages and responses. Without this, the agent processes requests but replies never appear in Slack.
app_mentions:read Receive @mention events in channels
files:read Access uploaded files
files:write Upload files to Slack
channels:history Read messages in public channels
groups:history Read messages in private channels
im:history Read direct messages
mpim:history Read group direct messages
users:read Look up user information
users:read.email Retrieve user email addresses
users.profile:read Read user profiles for email lookup

Required Event Subscriptions

Under Event Subscriptions > Subscribe to bot events, add:

  • app_mention (when someone @mentions your bot)

  • message.channels (messages in public channels the bot is in)

  • message.groups (messages in private channels the bot is in)

  • message.im (direct messages to your bot)

  • message.mpim (messages in group DMs that include the bot)

Without event subscriptions, the bot connects to Slack but never receives messages.


Configuration

Add your Slack tokens to the project’s .env file:


SLACK_BOT_TOKEN=xoxb-your-bot-token

SLACK_APP_TOKEN=xapp-your-app-token

Agent Mesh loads .env automatically at startup. The key section in the generated config file (configs/gateways/my-slack.yaml) is the adapter_config block:

app_config:
  namespace: "${NAMESPACE}"
  gateway_adapter: sam_slack_gateway_adapter.adapter.SlackAdapter

  adapter_config:
    slack_bot_token: ${SLACK_BOT_TOKEN}
    slack_app_token: ${SLACK_APP_TOKEN}
    slack_initial_status_message: "Got it, thinking..."
    correct_markdown_formatting: true
    feedback_enabled: false
    slack_email_cache_ttl_seconds: 3600

  default_agent_name: "OrchestratorAgent"

Configuration Options

Option Default Description
slack_bot_token (required) Bot token (xoxb-...) from your Slack app
slack_app_token (required) App token (xapp-...) for Socket Mode
slack_initial_status_message "Got it, thinking..." Message shown while the agent processes
correct_markdown_formatting true Convert standard markdown to Slack mrkdwn format
feedback_enabled false Show thumbs up/down buttons on agent responses
slack_email_cache_ttl_seconds 3600 How long to cache email lookups (seconds)

Start the entrypoint:


sam run configs/gateways/my-slack.yaml


Sessions: Threads as Conversations

The Slack Entrypoint maps Slack threads to Agent Mesh sessions. Each thread is a separate conversation with its own history and artifacts.

The session ID is derived from the channel and thread: slack-{channel_id}-{thread_ts}. New thread, new session, fresh agent context. Reply in the same thread, and the agent has the full conversation history.

This is a natural fit. Slack users already think in threads. The entrypoint just maps that mental model to the agent mesh.

If a message has no thread (a top-level message in a channel), the session is scoped to the channel only. The agent treats it as a standalone interaction.


Streaming Responses

Agent responses stream back to Slack in near real-time. Here is how it works:

  1. When a task starts, the adapter posts an initial status message (e.g., “Got it, thinking…”)

  2. As the agent produces text chunks, the adapter queues them and updates the Slack message

  3. Updates are delivered sequentially through a per-task message queue with rate limiting, so Slack’s API is not overwhelmed

  4. When the task completes, the adapter does a final update pass and optionally adds feedback buttons

The result is a response that builds up progressively in the Slack thread, similar to how ChatGPT displays responses, while staying within Slack’s rate limits.


User Identity

The adapter maps Slack users to Agent Mesh identity automatically. It looks up each user’s email address via the Slack API and passes it to agents as the primary identifier. No extra authentication setup is needed. Slack handles authentication, and the adapter forwards the identity. RBAC policies and audit logs work based on actual user emails.

For details on identity resolution, email caching, and fallback behavior, see the plugin documentation.


File Handling

Files flow both directions through the Slack Entrypoint.

Uploading Files to Agents

When a user attaches a file to their Slack message, the adapter downloads it from Slack and attaches it to the A2A task. The agent receives the file as a content part and can process it: summarize documents, analyze images, parse data files.

Receiving Files from Agents

When agents create files (reports, charts, generated code), the adapter uploads them back to Slack using a multi-step upload flow:

  1. Request an upload URL from Slack (files.getUploadURLExternal)

  2. Upload the file bytes to the temporary URL

  3. Finalize the upload and post it to the thread (files.completeUploadExternal)

Files with inline bytes are uploaded directly. Files referenced by artifact URI are downloaded from the artifact service first, then uploaded to Slack.


Feedback and Formatting

The adapter supports two additional features worth knowing about:

  • Feedback collection. Set feedback_enabled: true to add thumbs up/down buttons to agent responses. Users can submit optional comments. Feedback flows to the agent mesh for evaluation and quality tracking.

  • Markdown conversion. Slack uses its own markup format (mrkdwn). With correct_markdown_formatting: true (the default), the adapter converts standard markdown automatically, so agents do not need Slack-specific formatting logic.

For configuration details on both, see the plugin documentation.


Tips and Best Practices

  1. Set default_user_identity: "sam_dev_user" to match the WebUI’s default user. This ensures consistent identity across entrypoints. You can see Slack tasks in the WebUI’s Activity tab for debugging.

  2. Start with feedback disabled. Get the basic message flow working first. Enable feedback_enabled: true once you are ready to collect user feedback.

  3. Use system_purpose to shape responses for Slack. Instruct agents to keep responses concise and chat-friendly. Long, detailed responses that work in a blog post do not work well in a Slack thread.

  4. Thread discipline matters. Each thread is a session. Encourage your team to use threads for multi-turn conversations rather than posting sequential messages in the channel.

  5. Watch your email cache TTL. The default (3600 seconds / 1 hour) is fine for most teams. If your organization has high user turnover or email changes, reduce it.

  6. The Slack adapter is the best reference implementation. If you are building a custom chat entrypoint for another platform (Discord, Telegram, Microsoft Teams), study the Slack adapter source code. At approximately 1,150 lines, it demonstrates streaming with message queuing, file uploads, citation resolution, feedback buttons, and error handling.


Learn More