Slack Integration
In this tutorial, you will integrate a Slack interface into Solace Agent Mesh, enabling interaction with the system directly from your Slack workspace and channels.
We recommend you read about Gateways before you start this tutorial.
Setting Up the Environment
First, you need to install Solace Agent Mesh and Solace Mesh Agent (SAM) CLI, and then you'll want to create a new Solace Agent Mesh project or create a new plugin.
Creating the Slack App
Next, create a Slack Application in your workspace.
- Go to the Slack Application website.
- Select Your Apps and click Create New App.
- Choose From a manifest and apply the following configuration.
- You can customize the name and description, but keep the rest of the configuration and settings unchanged.
display_information:
name: solace-agent-mesh-bot
description: An app to integrate with Solace Agent Mesh
features:
app_home:
home_tab_enabled: false
messages_tab_enabled: true
messages_tab_read_only_enabled: false
bot_user:
display_name: Solace Agent Mesh
always_online: false
oauth_config:
scopes:
bot:
- app_mentions:read
- bookmarks:read
- channels:history
- channels:join
- channels:manage
- channels:read
- chat:write
- chat:write.customize
- chat:write.public
- files:read
- files:write
- groups:history
- groups:read
- groups:write
- im:history
- im:read
- im:write
- links:read
- links:write
- mpim:history
- mpim:read
- mpim:write
- pins:read
- pins:write
- reactions:read
- reactions:write
- reminders:read
- reminders:write
- team:read
- usergroups:read
- usergroups:write
- users.profile:read
- users:read.email
- users:read
- users:write
- conversations.connect:read
- conversations.connect:write
- incoming-webhook
settings:
event_subscriptions:
bot_events:
- app_mention
- message.groups
- message.im
interactivity:
is_enabled: true
org_deploy_enabled: false
socket_mode_enabled: true
token_rotation_enabled: false
Then select Create
and your new App will be created.
App-Level Tokens
In your created App, select Basic Information
under Settings
. Scroll down to App-Level Tokens
and click Generate Token and Scopes
.
Provide your token a name, add all available scopes, and then click Generate
.
Make note of the resulting application token (beginning with xapp-
) - you will need it in a future step.
Installing the App in Your Slack Workspace
Next, select Install App under Settings and following the installation flow to install the App in your workspace.
After installation, the bot token (beginning with -xoxb
) will be visible. Make note of this token.
Installing the Slack Interface and Gateway
After configuring your Slack App, the next step is to add the Slack interface and gateway to Solace Agent Mesh.
-
Create the gateway and interface using the Solace Agent Mesh (SAM) CLI:
sam add gateway slackbot --interface slack
This command generates two configuration files:
Created the following gateway template files:
- ./configs/gateways/slackbot/gateway.yaml
- ./configs/gateways/slackbot/slack.yaml -
Configure the required environment variables:
The Slack interface requires two authentication tokens. Add these to your
.env
file in the project root directory using the tokens generated during Slack App setup:SLACK_BOT_TOKEN=xoxb-xxxxxxxxxx
SLACK_APP_TOKEN=xapp-xxxxxxxxxxnoteWhile you can customize the gateway and interface behavior by modifying
gateway.yaml
andslack.yaml
, this is optional.
Running the Interface and Gateway
Launch the interface and gateway with:
sam run -be
For detailed information about available SAM CLI commands, see Solace Agent Mesh CLI.
Testing the Installation
To test your installation:
- Open your Slack workspace in the desktop app or browser.
- Find and click on the Solace Agent Mesh app under the Apps section.
- Send a test message by typing
hello
and click Enter. - You should see:
- A "Chatbot is thinking..." status message
- A response from the chatbot within a few seconds