Slack Integration
The most comprehensive Slack integration for enterprise knowledge management. Sync channel history, enable AI-powered responses, and bring your knowledge base directly into Slack.
Features
| Feature | Description |
|---|---|
| Data Sync | Index channel messages, threads, and files |
| AI Bot | Answer questions with citations from your knowledge base |
| Slash Commands | \/ask\, \/search\, \/summarize\ |
| @Mentions | Respond when mentioned in any channel |
| Thread Context | Maintain conversation history in threads |
| File Processing | Index shared PDFs, docs, images |
| Real-time Updates | Webhook-driven instant responses |
Prerequisites
- Slack workspace admin access (for app installation)
- LH42 organization with Slack integration enabled
Setup
Step 1: Install the Slack App
- Go to Settings > Integrations > Slack
- Click Add to Slack
- Select your workspace
- Review and approve permissions:
- \channels:history\ - Read channel messages
- \channels:read\ - View channel info
- \chat:write\ - Send messages
- \commands\ - Handle slash commands
- \files:read\ - Access shared files
- \users:read\ - View user profiles
Step 2: Configure Channels
Choose which channels to enable:
\\\`python
# Sync specific channels
client.integrations.slack.configure({
"channels": {
"sync_history": ["#general", "#engineering", "#support"],
"bot_enabled": ["#ask-anything", "#help"],
"auto_respond": False # Only respond when mentioned
}
})
\\\`
Channel modes:
- \
sync_history\- Index historical messages - \
bot_enabled\- Allow @mentions and commands - \
auto_respond\- Respond to all messages (use carefully)
Step 3: Configure Bot Behavior
\\\`python
client.integrations.slack.configure({
"bot": {
"name": "LH42 Assistant",
"response_style": "concise", # concise | detailed | conversational
"show_citations": True, # Include source links
"citation_format": "inline", # inline | footer | expandable
"thread_replies": True, # Always reply in threads
"typing_indicator": True, # Show "typing..." while processing
"error_dm": True # DM user on errors
}
})
\\\`
Using the Bot
Slash Commands
\\\`
/ask What is our refund policy?
\\\`
Response includes:
- AI-generated answer
- Source citations with links
- Confidence indicator
- Feedback buttons (👍/👎)
@Mentions
\\\`
@LH42 Can you summarize the Q4 roadmap?
\\\`
Thread Conversations
Start a thread for follow-up questions:
\\\`
User: @LH42 What's our vacation policy?
LH42: Based on the Employee Handbook, you get 20 days PTO...
User: Does that include sick days?
LH42: No, sick days are separate. You have unlimited sick days...
\\\`
Data Ingestion
What Gets Indexed
| Content | Indexed | Notes |
|---|---|---|
| Public channel messages | ✅ | Full text searchable |
| Private channel messages | ✅ | If bot is invited |
| Direct messages | ❌ | Privacy - never indexed |
| Threads | ✅ | Parent + replies |
| Reactions | ✅ | As engagement metadata |
| Files | ✅ | PDFs, docs, images (OCR) |
| Code snippets | ✅ | Syntax-aware indexing |
Sync Configuration
\\\`python
client.connectors.configure("slack", {
"settings": {
"channels": ["C01234567", "C89012345"], # Channel IDs
"include_threads": True,
"include_files": True,
"lookback_days": 90, # Historical sync period
"sync_schedule": "0 */2 * * *" # Every 2 hours
}
})
\\\`
Webhook Architecture
Events API Flow
\\\`
Slack Event → POST /api/gateway/slack/events
│
├── Verify X-Slack-Signature (HMAC-SHA256)
│
├── Check idempotency (event_id)
│
├── Queue to Inngest
│
└── Process async:
├── Parse message
├── Query RAG pipeline
├── Generate response
├── Format as Slack Blocks
└── POST to Slack API
\\\`
Supported Events
| Event | Action |
|---|---|
\message\ | Process if mentioned or auto-respond |
\app_mention\ | Always process and respond |
\message.channels\ | Index for history sync |
\file_shared\ | Download and index file |
\reaction_added\ | Track engagement |
Response Formatting
Responses use Slack Block Kit for rich formatting:
\\\`json
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Based on the *Employee Handbook*, here's what I found:"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "You receive *20 days* of paid time off per year..."
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "📄 Sources: <https://...|Employee Handbook> • <https://...|PTO Policy>"
}
]
},
{
"type": "actions",
"elements": [
{"type": "button", "text": {"type": "plain_text", "text": "👍"}, "action_id": "feedback_positive"},
{"type": "button", "text": {"type": "plain_text", "text": "👎"}, "action_id": "feedback_negative"}
]
}
]
}
\\\`
API Reference
List Connected Channels
\\\`bash
GET /api/integrations/slack/channels
# Response
{
"channels": [
{
"id": "C01234567",
"name": "general",
"is_private": false,
"member_count": 150,
"bot_enabled": true,
"messages_indexed": 12500
}
]
}
\\\`
Send Proactive Message
\\\`bash
POST /api/integrations/slack/send
{
"channel": "C01234567",
"text": "New document uploaded: Q4 Report",
"blocks": [...]
}
\\\`
Get Conversation History
\\\`bash
GET /api/integrations/slack/conversations/{channel_id}?limit=50
\\\`
Notifications
Set up automated notifications:
\\\`python
client.integrations.slack.create_notification({
"name": "New Document Alert",
"channel": "#knowledge-updates",
"events": ["document.processed"],
"template": "📄 New document indexed: {title}\n{summary}"
})
client.integrations.slack.create_notification({
"name": "Weekly Digest",
"channel": "#team-updates",
"schedule": "0 9 * * 1", # Monday 9am
"template": "weekly_digest"
})
\\\`
Enterprise Features
Slack Enterprise Grid
For Enterprise Grid workspaces:
\\\`python
client.integrations.slack.configure({
"enterprise": {
"org_wide_install": True,
"workspaces": ["T01234567", "T89012345"],
"admin_approval_required": True
}
})
\\\`
User Mapping
Link Slack users to LH42 accounts for personalized results:
\\\`python
client.integrations.slack.map_users({
"auto_map_by_email": True, # Match by email domain
"default_role": "viewer",
"sync_profile_photos": True
})
\\\`
Security
- Signing Secret: All webhooks verified via HMAC-SHA256
- Token Rotation: OAuth tokens refreshed automatically
- Scope Minimization: Only request necessary permissions
- Audit Logging: All bot interactions logged
Troubleshooting
| Issue | Solution |
|---|---|
| Bot not responding | Verify bot is invited to channel |
| "Not authorized" | Check OAuth scopes, re-authorize if needed |
| Slow responses | Check Inngest queue health |
| Missing messages | Verify \channels:history\ scope |
| Duplicate responses | Check idempotency - may need cache clear |
Next Steps
- Microsoft Teams - Similar setup for Teams
- Communication Overview - Architecture deep-dive