Solace Agent Mesh gateway adapter for Slack using the new gateway framework
Project description
Slack Gateway Adapter SAM Plugin
This plugin provides a Slack gateway adapter for the Solace Agent Mesh framework using the new generic gateway framework. It allows you to interact with Slack channels and messages, enabling bi-directional communication between Slack users and SAM agents.
About Solace Agent Mesh
Solace Agent Mesh (SAM) is an open-source framework for building event-driven, multi-agent AI systems where specialized agents collaborate on complex tasks. It provides a standardized way for agents to communicate, share data, and integrate with external systems while keeping components loosely coupled and production-ready.
SAM helps you:
- Build event-driven multi-agent systems on Solace Event Mesh
- Connect agents, tools, gateways, and services through a common runtime
- Extend projects with installable plugins such as
sam-slack-gateway-adapter
Learn more in the Solace Agent Mesh documentation and the main project repository.
Overview
The Slack Gateway Adapter is a complete replacement for the legacy sam-slack plugin, built on the modern SAM gateway architecture. It provides:
- Socket Mode Integration: Real-time communication with Slack via WebSocket
- Rich Message Support: Text, files, images, and structured data
- Thread Management: Maintains conversation context in Slack threads
- User Authentication: Maps Slack users to SAM identity via email
- Embed Resolution: Automatically resolves and processes embedded artifacts
- Feedback Collection: Optional integration with feedback services
Installation
Once the plugin is installed (e.g., from PyPI or a local wheel file):
sam plugin add <your-new-component-name> --plugin sam-slack-gateway-adapter
This will create a new component configuration at configs/plugins/<your-new-component-name-kebab-case>.yaml.
Configuration
Required Environment Variables
SLACK_BOT_TOKEN: Your Slack Bot Token (starts with 'xoxb-')SLACK_APP_TOKEN: Your Slack App Token for Socket Mode (starts with 'xapp-')NAMESPACE: The SAM namespace for your deployment
Slack App Setup
To use this plugin, you need to create a Slack App with the following configurations:
-
Socket Mode: Enable Socket Mode in your Slack App settings
-
Bot Token Scopes: Add the following OAuth scopes:
app_mentions:read- View messages that directly mention your appchat:write- Send messages as the appfiles:read- View files shared in channels and conversationsfiles:write- Upload, edit, and delete files as the appchannels:history- View messages and other content in public channelsgroups:history- View messages and other content in private channelsim:history- View messages and other content in direct messagesmpim:history- View messages and other content in group direct messagesusers:read- View people in the workspaceusers:read.email- View email addresses of people in the workspace
-
Event Subscriptions: Subscribe to the following bot events:
app_mention- When your app is mentioned in a channelmessage.channels- Messages in public channelsmessage.groups- Messages in private channelsmessage.im- Direct messages to your appmessage.mpim- Group direct messages
Configuration Options
The main configuration options in your component YAML file:
app_config:
# Gateway Configuration
namespace: "${NAMESPACE}"
gateway_id: my-slack-gateway-01 # Auto-generated if omitted
default_agent_name: "OrchestratorAgent" # Agent to use if no mention specifies one
# Slack Adapter-Specific Config
adapter_config:
slack_bot_token: ${SLACK_BOT_TOKEN}
slack_app_token: ${SLACK_APP_TOKEN}
slack_initial_status_message: ":thinking_face: Thinking..." # Set empty "" to disable
correct_markdown_formatting: true
slack_email_cache_ttl_seconds: 3600 # Cache user email lookups for 1 hour
feedback_enabled: false # Enable to show thumbs up/down feedback buttons
# Embed Resolution
enable_embed_resolution: true
gateway_artifact_content_limit_bytes: 10000000 # 10MB
gateway_recursive_embed_depth: 3
# Authorization
authorization_service:
type: "none" # Or "default_rbac"
Usage
Interacting with the Gateway
Once deployed, users can interact with your SAM agents via Slack:
- Direct Mention:
@YourBot what is the weather today? - Direct Message: Send a DM to your bot
- Thread Replies: Continue conversations in threads
Agent Selection
- Default Agent: Messages without a specific agent mention use
default_agent_name - Specific Agent: Mention an agent by name:
@YourBot @WeatherAgent what's the forecast?
File Attachments
The adapter automatically processes files attached to Slack messages and makes them available to agents as artifacts.
Features
Message Queue Management
The adapter includes intelligent message queue management to:
- Handle rate limits gracefully
- Batch status updates efficiently
- Prevent duplicate messages
- Manage thread contexts
Markdown Formatting
Slack markdown differs from standard markdown. The adapter can automatically convert:
- Code blocks and inline code
- Bold and italic text
- Lists and formatting
- Links and mentions
Set correct_markdown_formatting: true to enable automatic conversion.
User Feedback Collection
The adapter supports optional thumbs up/down feedback collection on task completions:
-
Enable in adapter config:
adapter_config: feedback_enabled: true
-
Configure feedback publishing (optional - if you want to send feedback to an external service):
feedback_publishing: enabled: true feedback_post_url: "http://your-feedback-service.example.com/feedback" feedback_post_headers: Authorization: "Bearer your_feedback_token" Content-Type: "application/json"
When enabled, users will see thumbs up/down buttons after task completion. They can optionally provide text comments. Feedback is submitted via the SAM feedback mechanism.
Error Handling
Errors are gracefully reported back to users in Slack with helpful messages and context.
Development
Running Tests
hatch test
Building the Package
hatch build
Architecture
This plugin is built on the SAM Generic Gateway Framework and implements the GatewayAdapter interface. It handles:
- Inbound: Slack events → SAM tasks
- Outbound: SAM updates → Slack messages
- State Management: Thread tracking and user context
- Identity: User email mapping for authentication
Troubleshooting
Bot doesn't respond to messages
- Verify
SLACK_BOT_TOKENandSLACK_APP_TOKENare set correctly - Check that Socket Mode is enabled in your Slack App
- Ensure your bot has been invited to the channel
- Review logs for connection errors
User identity issues
- Verify the bot has
users:read.emailscope - Check that users have email addresses associated with their Slack accounts
- Review
slack_email_cache_ttl_secondssetting
Rate limiting
- The adapter includes built-in rate limit handling
- Consider adjusting message batch sizes if hitting limits frequently
License
See the LICENSE file in the root of the repository.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sam_slack_gateway_adapter-0.1.1-py3-none-any.whl.
File metadata
- Download URL: sam_slack_gateway_adapter-0.1.1-py3-none-any.whl
- Upload date:
- Size: 46.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4fd9f6278d555874f9354c13db1ef70230462979312dd894f9e00ef6b8b3f37
|
|
| MD5 |
7aafc52d2c76e70883b97338e389ab75
|
|
| BLAKE2b-256 |
103630977a7bb4aaa50221df47a02119906f356236ed1585376a7ebe94f646b5
|
Provenance
The following attestation bundles were made for sam_slack_gateway_adapter-0.1.1-py3-none-any.whl:
Publisher:
release.yaml on SolaceLabs/solace-agent-mesh-core-plugins
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sam_slack_gateway_adapter-0.1.1-py3-none-any.whl -
Subject digest:
e4fd9f6278d555874f9354c13db1ef70230462979312dd894f9e00ef6b8b3f37 - Sigstore transparency entry: 1393553572
- Sigstore integration time:
-
Permalink:
SolaceLabs/solace-agent-mesh-core-plugins@f5f467f93f8786cb8e654cb6583c62301fe25f93 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/SolaceLabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@f5f467f93f8786cb8e654cb6583c62301fe25f93 -
Trigger Event:
workflow_dispatch
-
Statement type: