💬 Slack Integration
Connect Datix xAgents to Slack to receive notifications, run queries, and collaborate with your team.
Overview
Slack Integration enables:
- Real-time notifications in Slack channels
- Run queries using slash commands
- Share insights with team
- Agent execution alerts
- Workflow completion notifications
- Approve actions directly from Slack
📦 Plan Requirement
Slack Integration is available in Growth plan and above.
Setup
1. Create Slack App
- Go to api.slack.com/apps
- Click "Create New App"
- Choose "From Scratch"
- Name: "Datix xAgents"
- Select your workspace
2. Configure OAuth & Permissions
Add these scopes:
Bot Token Scopes:
- chat:write Send messages
- chat:write.public Post to public channels
- channels:read View channel list
- users:read View user info
- commands Enable slash commands
3. Install to Workspace
- Go to "Install App" section
- Click "Install to Workspace"
- Authorize the app
- Copy the "Bot User OAuth Token"
4. Configure in Datix xAgents
- Navigate to Settings → Integrations
- Click "Add Integration"
- Select "Slack"
- Paste Bot Token
- Select default channel for notifications
- Click "Save"
POST /api/integrations
{
"provider": "slack",
"config": {
"bot_token": "xoxb-your-bot-token",
"default_channel": "#datix-alerts",
"notify_query_completion": true,
"notify_agent_execution": true,
"notify_workflow_completion": true
}
}
Features
Notifications
Receive alerts for:
- Query Completion: When long-running queries finish
- Agent Execution: Autonomous agent results
- Workflow Completion: Workflow execution status
- Anomaly Detection: AI insights and anomalies
- Approval Requests: Actions needing approval
- Error Alerts: Failed executions
Notification Example
📊 Query Completed
─────────────────
Query: Monthly Sales Analysis
Status: ✅ Success
Rows: 1,247
Duration: 3.2s
─────────────────
[View Results] [Share]
Slash Commands
Run queries from Slack:
/datix query What were our top products last month?
/datix status Check status of agent #123
/datix template Run monthly report template
/datix help Show available commands
Interactive Buttons
Notifications include action buttons:
- View Results: Opens query in browser
- Share: Share with team members
- Approve/Reject: For approval workflows
- Rerun: Execute query again
- Download: Get CSV export
Configuration Options
Channel Routing
Send different notifications to different channels:
{
"channels": {
"query_completion": "#data-queries",
"agent_execution": "#ai-agents",
"anomaly_detection": "#alerts",
"errors": "#errors",
"approvals": "#approvals"
}
}
Notification Filters
Control what gets sent to Slack:
- Minimum Duration: Only notify for queries >30s
- Query Types: Only multi-database queries
- Priority Only: High-priority agents only
- Error Level: Only critical errors
{
"filters": {
"min_query_duration": 30,
"query_types": ["multi_database"],
"agent_priority": ["high", "critical"],
"error_level": ["critical"]
}
}
Message Formatting
Customize notifications:
- Include/exclude result preview
- Show/hide execution time
- Add custom emoji
- Include user mentions
Slash Commands Setup
1. Create Slash Command
- In Slack App settings, go to "Slash Commands"
- Click "Create New Command"
- Command:
/datix - Request URL:
https://your-domain.com/api/slack/commands - Description: "Run Datix xAgents queries"
- Usage hint:
query [your question] - Save
2. Available Commands
/datix query [question]
Run a natural language query
Example: /datix query Show top 10 customers
/datix template [template_id]
Execute a saved template
Example: /datix template 123
/datix status [agent_id]
Check agent execution status
Example: /datix status 456
/datix list
List your recent queries
/datix help
Show command help
Approval Workflows
Approve Actions in Slack
When an agent requires approval:
- Notification sent to approvals channel
- Shows action details and context
- Buttons: "Approve" or "Reject"
- Click button to respond
- Agent continues or stops based on response
Approval Message Example
🔔 Approval Required
─────────────────────
Agent: Sales Anomaly Detector
Action: Send alert email to team
Reason: Detected 25% drop in sales
Time: 2 hours ago
─────────────────────
[Approve] [Reject] [View Details]
Query Results in Slack
Result Preview
Slack messages include data preview:
- First 5 rows of results
- Total row count
- Key metrics highlighted
- Execution metadata
Result Formatting
📊 Query Results
─────────────────
Top 5 Products:
1. Product A - $12,450
2. Product B - $11,200
3. Product C - $9,800
4. Product D - $8,600
5. Product E - $7,300
Total: 152 products
─────────────────
[View All Results]
User Mentions
Notify Specific Users
Tag users in notifications:
POST /api/integrations/slack/notify
{
"channel": "#data-alerts",
"message": "Anomaly detected in sales data",
"mentions": ["@john", "@sarah"],
"include_results": true
}
User Mapping
Map Datix users to Slack users:
- By email address (automatic)
- Manual mapping in settings
- Fallback to @channel for unmapped users
Webhooks
Incoming Webhooks
Send custom messages to Slack:
POST https://hooks.slack.com/services/YOUR/WEBHOOK/URL
{
"text": "Daily report completed",
"attachments": [{
"color": "good",
"title": "Sales Report",
"text": "Revenue: $125,000 (+12%)",
"fields": [
{ "title": "Orders", "value": "342", "short": true },
{ "title": "AOV", "value": "$365", "short": true }
]
}]
}
Best Practices
- Dedicated Channels: Create separate channels for different notification types
- Filter Noise: Only send important notifications to avoid spam
- Use Threads: Reply in threads to keep channels clean
- Mention Sparingly: Only @mention when action required
- Test First: Use a test channel before production
- Document Commands: Post slash command help in channel description
⚠️ Token Security
Keep your Bot Token secret. Never commit it to version control. Rotate tokens regularly.
Troubleshooting
Messages Not Appearing
- Verify bot is invited to channel
- Check token is valid
- Ensure app has correct scopes
- Check integration status in settings
Slash Commands Not Working
- Verify Request URL is correct
- Check firewall allows Slack IPs
- Ensure endpoint responds within 3 seconds
- Check application logs for errors
Common Errors
channel_not_found
→ Invite bot to channel
not_authed
→ Token expired or invalid
rate_limited
→ Too many messages, slow down
invalid_payload
→ Check message format
Rate Limits
Slack enforces rate limits:
- Tier 1: 1 message per second
- Tier 2: 20 messages per minute
- Tier 3: 50 messages per minute (with bursts)
- Datix automatically handles rate limiting
Permissions
To configure Slack integration:
- Admin role in Datix xAgents
- Workspace Admin in Slack
- Growth plan or above