AI Agent for Slack: Build Smart Bots That Actually Help Your Team
Your team spends 32% of their workday in Slack. An AI agent that lives there — answering questions, triaging tickets, running standups — saves hours per person per week. Here's how to build one that people actually use.
What's Inside
- Why Slack Agents Beat Standalone AI Tools
- 6 Types of Slack AI Agents
- Architecture: How Slack Agents Work
- Building a Knowledge Base Agent
- Building a Support Triage Agent
- Building an Async Standup Agent
- Production System Prompt
- Tool Comparison: 7 Slack AI Platforms
- Build Your Slack Agent in 45 Minutes
- 8 Mistakes That Make Slack Agents Annoying
Why Slack Agents Beat Standalone AI Tools
Your team won't open a new tab for an AI tool. They won't switch apps. They won't remember the URL. But they're already in Slack — all day, every day.
That's why the best AI agents live where the work happens:
Context switching kills productivity
Every time someone leaves Slack to search Notion, check Jira, ask in a different channel, or ping a colleague for info — that's 5-15 minutes lost. Multiply by 20 questions per day across a 10-person team: 16-50 hours/week wasted on information retrieval.
An AI agent that answers instantly, in context
@mention the agent in any channel. It searches your docs, past conversations, Jira tickets, and Notion pages. It answers with sources. No tab switching. No waiting for someone to respond. No "let me find that for you" messages.
The numbers back this up:
- 73% of questions in Slack channels have already been answered somewhere — in docs, previous threads, or other channels
- Average response time from a human: 23 minutes. From an AI agent: 3 seconds
- Teams with Slack AI agents report 40-60% fewer repeated questions in support channels
- New employee onboarding time drops by 30% when they can ask an agent instead of interrupting colleagues
6 Types of Slack AI Agents
Knowledge Base Agent
What it does: Answers questions from your documentation (Notion, Confluence, Google Docs, GitHub wikis). "What's our refund policy?" "How do I set up the dev environment?" "What's the PTO process?"
Best for: Teams with 50+ docs that nobody reads. Especially powerful for onboarding.
Support Triage Agent
What it does: Monitors #support or #help channels. Auto-categorizes issues (bug, feature request, question). Suggests solutions from past tickets. Escalates to the right person when it can't help.
Best for: Teams handling 20+ internal support requests per day.
Async Standup Agent
What it does: Collects standup updates via DM at a scheduled time. Summarizes all updates in a team channel. Flags blockers. Tracks patterns (same blocker for 3 days = alert).
Best for: Remote/distributed teams tired of standup meetings.
Meeting Summary Agent
What it does: Watches for Zoom/Google Meet recordings posted in channels. Transcribes, summarizes key decisions, and extracts action items. Posts summary with @mentions for assigned tasks.
Best for: Teams with 5+ meetings per day where people miss important decisions.
Workflow Automation Agent
What it does: Natural language commands for common workflows. "Create a Jira ticket for the login bug John reported" "Schedule a meeting with the design team next Tuesday" "Summarize this thread and post in #engineering"
Best for: Teams using 5+ SaaS tools that need to work together.
Code Review Agent
What it does: Posts PR summaries in #engineering. Highlights risky changes. Answers questions about the codebase. "What does the payment service do?" "Who last changed the auth module?"
Best for: Engineering teams with a large, complex codebase.
Architecture: How Slack Agents Work
┌─────────────────────────────────────────────┐
│ Slack │
│ @agent question │ /command │ reaction │
└────────┬──────────┴─────┬──────┴──────┬──────┘
│ │ │
▼ ▼ ▼
┌─────────────────────────────────────────────┐
│ Slack Bolt.js / Python SDK │
│ Event listener → Route → Respond │
├─────────────────────────────────────────────┤
│ AI Processing Layer │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Claude │ │ RAG │ │ Tools │ │
│ │ API │ │ Search │ │ (APIs) │ │
│ └──────────┘ └──────────┘ └──────────┘ │
├─────────────────────────────────────────────┤
│ Knowledge Sources │
│ Notion │ Confluence │ GitHub │ Jira │ Docs │
└─────────────────────────────────────────────┘
The key components:
- Slack Bolt SDK — handles events (messages, mentions, reactions, slash commands)
- AI processing — Claude/GPT-4 for understanding intent and generating responses
- RAG pipeline — vector search over your docs for accurate, sourced answers
- Tool integrations — Jira, Linear, GitHub, Google Calendar, Notion APIs
- Conversation memory — thread context so the agent follows multi-turn conversations
Building a Knowledge Base Agent
This is the highest-ROI Slack agent. Here's the complete architecture:
const { App } = require('@slack/bolt');
const Anthropic = require('@anthropic-ai/sdk');
const { createClient } = require('@supabase/supabase-js');
const app = new App({
token: process.env.SLACK_BOT_TOKEN,
signingSecret: process.env.SLACK_SIGNING_SECRET,
socketMode: true,
appToken: process.env.SLACK_APP_TOKEN,
});
const anthropic = new Anthropic();
const supabase = createClient(
process.env.SUPABASE_URL,
process.env.SUPABASE_KEY
);
// Listen for @mentions
app.event('app_mention', async ({ event, say }) => {
const question = event.text.replace(/<@[^>]+>/g, '').trim();
if (!question) return;
// Show typing indicator
const loading = await say({
text: '🔍 Searching docs...',
thread_ts: event.thread_ts || event.ts,
});
try {
// Step 1: Generate embedding for the question
const embedding = await getEmbedding(question);
// Step 2: Search knowledge base
const { data: docs } = await supabase.rpc('match_documents', {
query_embedding: embedding,
match_threshold: 0.7,
match_count: 5,
});
// Step 3: Get thread context (if in a thread)
let threadContext = '';
if (event.thread_ts) {
const { messages } = await app.client.conversations.replies({
channel: event.channel,
ts: event.thread_ts,
limit: 10,
});
threadContext = messages
.map(m => `${m.user}: ${m.text}`)
.join('\n');
}
// Step 4: Generate answer with Claude
const context = docs.map(d =>
`[Source: ${d.title}]\n${d.content}`
).join('\n\n---\n\n');
const response = await anthropic.messages.create({
model: 'claude-sonnet-4-20250514',
max_tokens: 1000,
system: KNOWLEDGE_AGENT_PROMPT,
messages: [{
role: 'user',
content: `Thread context:\n${threadContext}\n\n` +
`Relevant docs:\n${context}\n\n` +
`Question: ${question}`
}],
});
const answer = response.content[0].text;
// Step 5: Update the loading message with the answer
await app.client.chat.update({
channel: event.channel,
ts: loading.ts,
text: answer,
blocks: [{
type: 'section',
text: { type: 'mrkdwn', text: answer },
}, {
type: 'context',
elements: [{
type: 'mrkdwn',
text: `📚 Sources: ${docs.map(d => d.title).join(' · ')}`,
}],
}, {
type: 'actions',
elements: [{
type: 'button',
text: { type: 'plain_text', text: '👍 Helpful' },
action_id: 'feedback_positive',
value: event.ts,
}, {
type: 'button',
text: { type: 'plain_text', text: '👎 Not helpful' },
action_id: 'feedback_negative',
value: event.ts,
}],
}],
});
} catch (error) {
console.error('Error:', error);
await app.client.chat.update({
channel: event.channel,
ts: loading.ts,
text: `❌ Sorry, I hit an error. Try rephrasing or ask in #help.`,
});
}
});
// Feedback tracking
app.action('feedback_positive', async ({ ack, body }) => {
await ack();
await supabase.from('feedback').insert({
question_ts: body.actions[0].value,
rating: 'positive',
user: body.user.id,
});
});
app.action('feedback_negative', async ({ ack, body }) => {
await ack();
await supabase.from('feedback').insert({
question_ts: body.actions[0].value,
rating: 'negative',
user: body.user.id,
});
// DM the user for more details
await app.client.chat.postMessage({
channel: body.user.id,
text: "Sorry that wasn't helpful! Could you tell me what was " +
"wrong so I can improve? Was the answer: incorrect, " +
"incomplete, or about the wrong topic?",
});
});
Use @anthropic-ai/sdk embeddings or OpenAI embeddings to vectorize your docs. Chunk documents into 500-token segments with 50-token overlap. Store in Supabase (pgvector), Pinecone, or Chroma. Re-index nightly via a cron job that checks for doc changes.
Building a Support Triage Agent
This agent watches your #support channel and automatically categorizes, suggests solutions, and routes issues:
// Listen to all messages in #support (not just mentions)
app.message(async ({ message, say }) => {
// Only process messages in #support channel
if (message.channel !== SUPPORT_CHANNEL_ID) return;
if (message.bot_id) return; // Ignore bot messages
const triageResult = await triageMessage(message.text);
if (triageResult.category === 'question') {
// Try to answer from knowledge base
const answer = await searchKnowledgeBase(message.text);
if (answer.confidence > 0.8) {
await say({
thread_ts: message.ts,
text: `💡 I might be able to help!\n\n${answer.text}\n\n` +
`_Source: ${answer.source}_\n\n` +
`If this doesn't solve it, I'll flag it for the team.`,
});
return;
}
}
// Route to the right person/team
const routeEmoji = {
bug: '🐛',
feature_request: '✨',
question: '❓',
urgent: '🚨',
feedback: '💬',
};
const assignee = await findBestAssignee(triageResult);
await say({
thread_ts: message.ts,
blocks: [{
type: 'section',
text: {
type: 'mrkdwn',
text: `${routeEmoji[triageResult.category] || '📋'} ` +
`*${triageResult.category.replace('_', ' ').toUpperCase()}*` +
` — Priority: ${triageResult.priority}\n\n` +
`Routed to <@${assignee.slackId}>\n` +
`${triageResult.suggestedAction || ''}`,
},
}],
});
// Create Jira/Linear ticket if it's a bug or feature request
if (['bug', 'feature_request'].includes(triageResult.category)) {
const ticket = await createTicket({
title: triageResult.summary,
description: message.text,
category: triageResult.category,
priority: triageResult.priority,
reporter: message.user,
slackLink: `https://slack.com/archives/${message.channel}/p${message.ts.replace('.', '')}`,
});
await say({
thread_ts: message.ts,
text: `📋 Created ticket: <${ticket.url}|${ticket.key}>`,
});
}
});
async function triageMessage(text) {
const response = await anthropic.messages.create({
model: 'claude-sonnet-4-20250514',
max_tokens: 300,
messages: [{
role: 'user',
content: `Triage this support message. Return JSON:
{
"category": "bug|feature_request|question|urgent|feedback",
"priority": "low|medium|high|critical",
"summary": "one-line summary for ticket title",
"suggestedAction": "what should happen next",
"team": "engineering|product|design|ops"
}
Message: ${text}`
}],
});
return JSON.parse(response.content[0].text);
}
Building an Async Standup Agent
const cron = require('node-cron');
// Send standup prompts at 9 AM every weekday
cron.schedule('0 9 * * 1-5', async () => {
const teamMembers = await getTeamMembers(TEAM_CHANNEL_ID);
for (const member of teamMembers) {
await app.client.chat.postMessage({
channel: member.id,
blocks: [{
type: 'section',
text: {
type: 'mrkdwn',
text: '👋 Good morning! Time for your standup update.',
},
}, {
type: 'input',
block_id: 'yesterday',
label: { type: 'plain_text', text: 'What did you work on yesterday?' },
element: { type: 'plain_text_input', action_id: 'yesterday_input', multiline: true },
}, {
type: 'input',
block_id: 'today',
label: { type: 'plain_text', text: "What's on your plate today?" },
element: { type: 'plain_text_input', action_id: 'today_input', multiline: true },
}, {
type: 'input',
block_id: 'blockers',
label: { type: 'plain_text', text: 'Any blockers?' },
element: { type: 'plain_text_input', action_id: 'blockers_input', multiline: true },
optional: true,
}, {
type: 'actions',
elements: [{
type: 'button',
text: { type: 'plain_text', text: '✅ Submit Standup' },
style: 'primary',
action_id: 'submit_standup',
}],
}],
});
}
});
// Collect responses and post summary at 10 AM
cron.schedule('0 10 * * 1-5', async () => {
const updates = await getTodayStandups();
if (updates.length === 0) return;
// Use Claude to create a smart summary
const response = await anthropic.messages.create({
model: 'claude-sonnet-4-20250514',
max_tokens: 1000,
messages: [{
role: 'user',
content: `Summarize these standup updates for a team channel.
Group by theme when possible. Highlight blockers prominently.
If the same blocker appears for multiple people, flag it as critical.
Updates:
${updates.map(u =>
`${u.name}: Yesterday: ${u.yesterday} | Today: ${u.today} | Blockers: ${u.blockers || 'None'}`
).join('\n')}`
}],
});
await app.client.chat.postMessage({
channel: TEAM_CHANNEL_ID,
text: `📋 *Daily Standup Summary — ${new Date().toLocaleDateString()}*\n\n` +
response.content[0].text +
`\n\n_${updates.length} of ${teamMembers.length} submitted_`,
});
});
Production System Prompt
const KNOWLEDGE_AGENT_PROMPT = `You are a helpful team assistant
in Slack for [COMPANY_NAME].
## Personality
- Friendly but concise — this is Slack, not email
- Use bullet points and short paragraphs
- Add relevant emoji sparingly (not every sentence)
- Match the team's communication style (casual but professional)
## Rules
1. ONLY answer from the provided documentation context
2. If the docs don't contain the answer, say: "I couldn't find this
in our docs. You might want to ask in #[relevant-channel] or
check with [team]."
3. ALWAYS cite your source: "According to [Doc Name]..."
4. If you're not confident (< 80%), add a disclaimer
5. For sensitive topics (HR, legal, security), always recommend
talking to the relevant team directly
6. Never make up policies or procedures
7. Keep answers under 300 words unless the question is complex
## Formatting for Slack
- Use *bold* for emphasis (not **bold**)
- Use \`code\` for technical terms
- Use > for quotes from documentation
- Use bullet points (•) for lists
- Link to full docs when available:
## Escalation
If the question involves:
- Account access or permissions → "Please contact #it-support"
- Billing or contracts → "Please reach out to #finance"
- HR or people matters → "Please speak with your People Partner"
- Production incidents → "Please use /incident in #engineering-oncall"
Never try to handle these yourself.`;
Get all 13 agent templates ready to deploy
The AI Employee Playbook includes the complete Slack agent setup, plus 12 other production-ready agent templates with system prompts and code.
Get the Playbook — €29Tool Comparison: 7 Slack AI Platforms
| Tool | Best For | Price | Custom Logic |
|---|---|---|---|
| Slack AI (native) | Channel summaries, search | $10/user/mo | ❌ Limited |
| Glean | Enterprise knowledge search | $15+/user/mo | ⚠️ Some |
| Guru | Knowledge management + Slack | $10/user/mo | ⚠️ Some |
| Threadly | Thread summaries | Free / $5/mo | ❌ None |
| M1 (by Loom) | Meeting notes in Slack | $12/user/mo | ❌ Limited |
| n8n + Slack | Workflow automation | Free / $20/mo | ✅ Full |
| Custom Agent (this guide) | Full control, any use case | ~$10-30/mo (API) | ✅ Full |
Our recommendation: Start with Slack's native AI for basic summaries. Use Glean if you have budget and need enterprise search. Build custom with Bolt.js when you need specific workflows, custom knowledge bases, or tight integration with your tools.
Build Your Slack Agent in 45 Minutes
Create the Slack App
Go to api.slack.com/apps. Create a new app. Enable Socket Mode (easier for development). Add bot scopes: app_mentions:read, chat:write, channels:history, im:write. Install to your workspace.
Set Up the Bolt.js Project
npm init -y && npm install @slack/bolt @anthropic-ai/sdk. Copy the knowledge base agent code from above. Set environment variables: SLACK_BOT_TOKEN, SLACK_SIGNING_SECRET, SLACK_APP_TOKEN, ANTHROPIC_API_KEY.
Index Your Documents
For a quick start, skip the vector database. Load your docs as plain text files and use Claude's context window directly (up to 200K tokens). For larger doc sets, set up Supabase with pgvector using the indexing script from the code above.
Deploy and Test
Run locally with node app.js. @mention your bot in a channel. Test with 10 questions you know the answers to. Refine the system prompt based on response quality. Deploy to Railway, Render, or a simple VPS ($5/mo).
8 Mistakes That Make Slack Agents Annoying
Responding to every message in a channel
Nobody wants a bot that replies to everything. Only respond when @mentioned, when a message matches a trigger pattern (like questions in #support), or when explicitly asked. Silent by default, helpful when called.
Writing essays in Slack
Slack is for quick communication. Keep answers under 200 words. If the answer needs more detail, provide a summary with a link to full docs. "Here's the short version: [answer]. Full details: [doc link]"
No feedback mechanism
Without feedback buttons (👍/👎), you'll never know what's working. Track positive/negative ratios per question category. Review negative feedback weekly. This is your training data for improvement.
Answering confidently when unsure
A wrong answer is worse than no answer. If the agent's confidence is below 80%, it should say so: "I'm not fully sure about this, but based on our docs..." Add a disclaimer. Let the human verify.
No conversation context in threads
If someone asks a follow-up in a thread, the agent needs the full thread context. Without it, every reply feels like talking to someone with amnesia. Always fetch the thread history before responding.
Stale knowledge base
If your docs changed last week but the agent's index is from last month, you'll get wrong answers. Set up automatic re-indexing — at minimum nightly, ideally triggered by doc changes via webhooks.
No rate limiting or abuse prevention
Without limits, one person can burn through your API budget in a day. Set per-user rate limits (e.g., 50 questions/day). Log usage. Alert on anomalies. Add a cooldown for repeated identical questions.
Ignoring Slack formatting
Markdown doesn't work in Slack — Slack has its own formatting (*bold*, _italic_, `code`). If your agent outputs **bold** or [links](url), it looks broken. Use Slack's mrkdwn format: *bold*, <url|text>, > quotes.
Build your team's AI assistant today
The AI Employee Playbook includes step-by-step Slack agent setup, system prompts for 6 agent types, and deployment guides.
Get the Playbook — €29What's Next
Start with the knowledge base agent — it's the highest ROI with the least complexity. Get it answering 10 common questions correctly. Then layer on triage, standups, and workflow automation as your team adopts it.
The teams that win aren't the ones with the fanciest AI. They're the ones that put useful AI where people already work. And your team already lives in Slack.
Want the complete agent-building system?
The AI Employee Playbook covers the 3-file framework, memory systems, autonomy rules, and real production examples.
Get the Playbook — €29