- Listen to messages in a Slack channel (via a trigger)
- Respond in Slack (via Slack tools)
Prerequisites
- An existing agent in Agent Builder (see Quickstart to create one)
- Admin access to a Slack workspace, or permission to install apps
Step 1: Connect to Slack
First, authorize LangSmith to access your Slack workspace and invite the bot to your channel.Open your agent
- In LangSmith, navigate to Agent Builder.
- Select your agent from My Agents.
- Click Edit Agent.
Start adding the Slack trigger
- Scroll down to the Triggers section.
- Click + Add trigger.
- Select Slack - Message Received.
Authorize Slack
- Click Connect to authorize the Slack connection.
- Sign in to your Slack workspace.
- Review the permissions and click Allow.
- You’ll be redirected back to LangSmith.
Invite the bot to your channel
Before selecting a channel, invite the bot to the channel you want to use. In Slack, go to that channel and type:
Step 2: Add Slack tools
Tools let your agent take actions. To respond in Slack, you need to add Slack tools.Add Slack tools
- In the agent editor, scroll to the Tools section.
- Click + Add tool.
- Search for “Slack” and add the tools you need:
- slack_send_channel_message - Post messages to a channel
- slack_reply_to_message - Reply in a thread
- slack_write_private_message - Send direct messages
- slack_read_channel_history - Read recent messages
- slack_read_thread_messages - Read thread replies
Authorize tools (if needed)
If prompted, click Connect to authorize the Slack tools. This may use the same authorization from Step 1.
Step 3: Configure agent behavior (optional)
Your agent needs to know how to handle incoming Slack messages. You can update its instructions by prompting it directly. In the agent chat, try something like:Step 4: Test the integration
Send a test message
In your Slack channel, send a message to test the agent:
Hello, can you help me?
Verify the response
Your agent should respond in the channel. You can view the agent’s activity in the Feed tab in Agent Builder.
How it works
When a message is posted in your monitored Slack channel:- Slack sends an event to LangSmith
- The trigger activates your agent with the message content
- Your agent processes the message and uses Slack tools to respond
- The response appears in Slack (in the same thread if replying to a thread)
Next steps
Slack app reference
Learn about permissions and privacy
Add more tools
Connect additional services to your agent
Add more triggers
Set up email, schedule, or webhook triggers
Use templates
Start from a pre-built agent template