Slack Integration
AgenticAnts provides a powerful Slack integration that enables real-time notifications and alerts for your AI agent operations. Get instant updates about critical errors, anomalies, prompt changes, and other important events directly in your Slack workspace.
Overview
The Slack integration allows you to:
- Receive real-time alerts about critical errors and anomalies
- Get notified when prompts are edited or created
- Jump directly from Slack messages to specific prompts in AgenticAnts
- Configure different notification channels per project
- Send test messages to verify your integration
- Customize notification preferences and filters
Features
Real-time Notifications
Stay informed with instant Slack notifications for:
- Critical Errors: Get alerted when AI agents encounter errors
- Anomalies: Receive notifications for unusual behavior or performance issues
- Prompt Changes: Track when prompts are modified or created
- Cost Alerts: Monitor when spending thresholds are exceeded
- Performance Issues: Get notified of latency spikes or failures
Channel Configuration
- Set up different notification channels for different event types
- Configure per-project Slack channels
- Route specific agent notifications to dedicated channels
- Support for both public and private channels
Rich Message Format
Slack messages include:
- Direct Links: Jump straight to the relevant resource in AgenticAnts
- Contextual Information: See key metrics and details at a glance
- Action Buttons: Quick actions directly from Slack
- Threaded Discussions: Keep conversations organized
Setup
Prerequisites
- A Slack workspace where you can install apps
- Workspace admin permissions (or ability to request app installation)
- AgenticAnts project with admin access
Local Development Setup
If you're setting up the integration for local development, you'll need additional tools:
- Node.js and pnpm installed
- macOS (for mkcert) or equivalent SSL certificate tool
- HTTPS enabled for OAuth callback
Creating a Slack App
- Go to Slack API Apps page (opens in a new tab)
- Click Create New App → From an app manifest
- Select your workspace
- Use the following app manifest as a template:
display_information:
name: AgenticAnts
description: AI Agent Observability and Monitoring
background_color: "#2563eb"
features:
bot_user:
display_name: AgenticAnts
always_online: true
oauth_config:
scopes:
bot:
- chat:write
- chat:write.public
- channels:read
- groups:read
- im:read
- mpim:read
settings:
org_deploy_enabled: false
socket_mode_enabled: false
token_rotation_enabled: false- Click Create to create your app
Adding App Icon (Optional)
Make your app more recognizable:
- In your Slack app settings, go to Basic Information
- Scroll to Display Information
- Upload the AgenticAnts logo as your app's avatar
- Save changes
Environment Variables
Configure your AgenticAnts environment:
- In your Slack app settings, go to Basic Information
- Copy the Client ID and Client Secret
- Add these to your
.envfile:
SLACK_CLIENT_ID=your_client_id_here
SLACK_CLIENT_SECRET=your_client_secret_hereHTTPS Setup for Local Development
The Slack OAuth flow requires HTTPS. For local development:
macOS Setup
# Install mkcert
brew install mkcert
# Install the local CA
mkcert -install
# Generate certificates for localhost
mkcert localhost 127.0.0.1
# Move certificates to web directory
mv localhost+1*.pem web/Windows Setup
# Install chocolatey if not already installed
# Then install mkcert
choco install mkcert
# Install the local CA
mkcert -install
# Generate certificates
mkcert localhost 127.0.0.1
# Move certificates to web directory
move localhost+1*.pem web\Linux Setup
# Install mkcert
# For Ubuntu/Debian
sudo apt install mkcert
# For other distributions, use appropriate package manager
# Install the local CA
mkcert -install
# Generate certificates
mkcert localhost 127.0.0.1
# Move certificates to web directory
mv localhost+1*.pem web/Starting Development Server
From the repository root, run:
pnpm run dev:httpsThis starts the Next.js development server with HTTPS enabled on https://localhost:3000.
Configuring OAuth Redirect URLs
- In your Slack app settings, go to OAuth & Permissions
- Under Redirect URLs, add:
- Development:
https://localhost:3000/api/public/slack/oauth - Production:
https://yourdomain.com/api/public/slack/oauth
- Development:
- Save URLs
Configuration
Connecting to Slack
- Navigate to your AgenticAnts project settings
- Go to the Integrations tab
- Find the Slack integration section
- Click Connect to Slack
- Authorize the app in your Slack workspace:
- Review the permissions requested
- Select the workspace to install to
- Click Allow
- You'll be redirected back to AgenticAnts
- Select the default notification channel
Channel Selection
After connecting, configure your notification channels:
- Choose a default channel for general notifications
- Optionally configure specific channels for:
- Error alerts
- Prompt notifications
- Cost alerts
- Performance monitoring
- Test the connection using the Send Test Message button
Notification Preferences
Customize what notifications you receive:
// Configure in project settings
{
"slack": {
"enabled": true,
"channels": {
"default": "#agenticants-alerts",
"errors": "#agenticants-errors",
"prompts": "#agenticants-prompts",
"costs": "#agenticants-costs"
},
"filters": {
"minSeverity": "warning",
"includeEvents": ["error", "prompt_change", "cost_alert"],
"excludeAgents": ["test-agent"]
}
}
}Usage
Receiving Notifications
Once configured, you'll automatically receive Slack notifications for enabled events.
Example error notification:
🚨 Critical Error in Production Agent
Agent: customer-support-bot
Error: OpenAI API timeout after 30s
Timestamp: 2024-01-15 14:32:15 UTC
Trace ID: trace_abc123
View Details → https://app.agenticants.ai/traces/trace_abc123Example prompt change notification:
📝 Prompt Updated
Prompt: customer-greeting-v2
Changed by: alice@company.com
Changes: Temperature increased from 0.7 to 0.9
Version: v2.1.0
View Prompt → https://app.agenticants.ai/prompts/prompt_xyz789Sending Test Messages
Verify your integration is working:
- Go to project settings → Integrations → Slack
- Click Send Test Message
- Check your configured Slack channel for the test message
- If successful, you'll see a confirmation in AgenticAnts
Manual Notifications
Send custom notifications via API:
// Using the AgenticAnts SDK
import { AgenticAnts } from '@agenticants/sdk'
const ants = new AgenticAnts({ apiKey: process.env.AGENTICANTS_API_KEY })
await ants.slack.sendMessage({
projectId: 'project_123',
channel: '#alerts',
text: 'Custom notification message',
blocks: [
{
type: 'section',
text: {
type: 'mrkdwn',
text: '*Important Alert*\nSomething happened!'
}
}
]
})API Reference
API Endpoints
GET /api/public/slack/install
Initiates the Slack OAuth installation flow.
Query Parameters:
projectId: AgenticAnts project ID
Response: Redirects to Slack authorization page
GET /api/public/slack/oauth
Handles Slack OAuth callback and stores integration details.
Query Parameters:
code: OAuth authorization codestate: Security state token (contains projectId)
Response:
{
"success": true,
"team_id": "T1234567890",
"channel_id": "C9876543210"
}Components
SlackConnectionCard
Displays connection status and provides connect/disconnect actions.
import { SlackConnectionCard } from '@/src/features/slack/components/SlackConnectionCard'
<SlackConnectionCard projectId={projectId} />SlackChannelSelector
Allows selection of Slack channels for notifications.
import { SlackChannelSelector } from '@/src/features/slack/components/SlackChannelSelector'
<SlackChannelSelector
projectId={projectId}
onChannelSelect={handleChannelSelect}
/>SlackTestButton
Sends a test message to verify the integration.
import { SlackTestButton } from '@/src/features/slack/components/SlackTestButton'
<SlackTestButton
projectId={projectId}
channelId={channelId}
/>Server Services
SlackService
Main service for Slack integration operations:
class SlackService {
// Send a message to Slack
async sendMessage(config: SlackMessageConfig): Promise<void>
// Get workspace channels
async getChannels(teamId: string): Promise<SlackChannel[]>
// Store integration details
async storeIntegration(projectId: string, config: SlackConfig): Promise<void>
// Retrieve integration details
async getIntegration(projectId: string): Promise<SlackIntegration | null>
// Remove integration
async deleteIntegration(projectId: string): Promise<void>
// Send test message
async sendTestMessage(projectId: string, channelId: string): Promise<boolean>
}TRPC Routes
slack.getIntegrationStatus
Returns the current connection status for a project.
const status = await trpc.slack.getIntegrationStatus.query({ projectId })
// Returns: { connected: boolean, teamName?: string, channelId?: string }slack.getChannels
Fetches available Slack channels for the connected workspace.
const channels = await trpc.slack.getChannels.query({ projectId })
// Returns: SlackChannel[]slack.disconnect
Disconnects the Slack integration for a project.
await trpc.slack.disconnect.mutate({ projectId })slack.sendTestMessage
Sends a test message to verify the integration.
const result = await trpc.slack.sendTestMessage.mutate({
projectId,
channelId: 'C1234567890'
})
// Returns: { success: boolean }Message Templates
Error Alert Template
{
blocks: [
{
type: 'header',
text: {
type: 'plain_text',
text: '🚨 Critical Error',
emoji: true
}
},
{
type: 'section',
fields: [
{ type: 'mrkdwn', text: `*Agent:*\n${agentName}` },
{ type: 'mrkdwn', text: `*Error:*\n${errorMessage}` },
{ type: 'mrkdwn', text: `*Timestamp:*\n${timestamp}` },
{ type: 'mrkdwn', text: `*Trace ID:*\n${traceId}` }
]
},
{
type: 'actions',
elements: [
{
type: 'button',
text: { type: 'plain_text', text: 'View Details' },
url: `https://app.agenticants.ai/traces/${traceId}`,
style: 'primary'
}
]
}
]
}Prompt Change Template
{
blocks: [
{
type: 'header',
text: {
type: 'plain_text',
text: '📝 Prompt Updated',
emoji: true
}
},
{
type: 'section',
fields: [
{ type: 'mrkdwn', text: `*Prompt:*\n${promptName}` },
{ type: 'mrkdwn', text: `*Changed by:*\n${userName}` },
{ type: 'mrkdwn', text: `*Version:*\n${version}` }
]
},
{
type: 'section',
text: {
type: 'mrkdwn',
text: `*Changes:*\n${changes}`
}
},
{
type: 'actions',
elements: [
{
type: 'button',
text: { type: 'plain_text', text: 'View Prompt' },
url: `https://app.agenticants.ai/prompts/${promptId}`
}
]
}
]
}Best Practices
Channel Organization
- Separate channels by severity: Use different channels for errors vs. informational updates
- Per-environment channels: Create separate channels for dev, staging, and production
- Team-specific channels: Route notifications to relevant team channels
- Use threads: Enable threaded replies to keep channels organized
Notification Management
- Filter noise: Only enable notifications for actionable events
- Set severity thresholds: Avoid alert fatigue by focusing on critical issues
- Use digest mode: For high-volume events, consider daily/weekly summaries
- Mute during maintenance: Temporarily disable notifications during planned downtime
Security
- Rotate tokens regularly: Update OAuth tokens every 90 days
- Limit channel access: Use private channels for sensitive notifications
- Review permissions: Regularly audit what the bot can access
- Monitor usage: Check Slack app audit logs for suspicious activity
Troubleshooting
Common Issues
"Invalid redirect URI" error
- Ensure your Slack app's OAuth redirect URLs include the correct callback URL
- Check that you're using HTTPS (required for OAuth)
- Verify the domain matches exactly (including port for local development)
Certificate errors during local development
- Make sure you've run
mkcert -installto install the local CA - Try accessing
https://localhost:3000directly and accepting the certificate - Restart your development server after generating certificates
- Check that certificate files are in the correct location
Messages not appearing in Slack
- Verify the bot is added to the target channel (
/invite @AgenticAnts) - Check that the channel ID is correct
- Ensure the bot has
chat:writepermission - Test with a public channel first before trying private channels
"Not authenticated" error
- Re-authenticate the Slack integration in project settings
- Verify your OAuth tokens haven't expired
- Check that the Slack app is still installed in your workspace
Test message fails
- Confirm the integration is properly connected
- Check that the selected channel still exists
- Verify the bot has permissions to post in the channel
- Review server logs for detailed error messages
Debug Mode
Enable debug logging for Slack integration:
# In your .env file
DEBUG=agenticants:slack:*
LOG_LEVEL=debugView logs:
# Server logs
tail -f logs/slack-integration.log
# Filter for Slack-specific entries
grep "SLACK" logs/server.logProduction Deployment
Pre-deployment Checklist
- Update OAuth redirect URLs to include production domain
- Set up proper SSL certificates for production environment
- Configure environment variables in production
- Test the integration in staging environment
- Document the Slack app installation for your team
- Set up monitoring for Slack API usage
- Configure rate limiting to avoid API quotas
Scaling Considerations
- Rate Limits: Slack has rate limits (~1 message per second per channel)
- Batch Messages: Group related notifications when possible
- Queue System: Use a message queue for high-volume notifications
- Retry Logic: Implement exponential backoff for failed messages
- Circuit Breaker: Disable integration temporarily if Slack is down
Future Enhancements
Planned features for future releases:
- Interactive Actions: Respond to alerts directly from Slack
- Slash Commands: Query AgenticAnts data from Slack (
/agenticants status) - Scheduled Reports: Daily/weekly summaries sent to Slack
- Thread Management: Automatic threading for related events
- @mentions: Mention specific team members in notifications
- Custom Workflows: Build custom notification workflows
- Bi-directional Sync: Create tickets/tasks from Slack messages
- Voice Alerts: Integration with Slack voice channels
Support
Need help with the Slack integration?
- Documentation: This guide and inline help
- Community: Join our Discord (opens in a new tab)
- GitHub: Report issues (opens in a new tab)
- Email: support@agenticants.ai
For enterprise customers:
- Dedicated Support: Direct access to our integration specialists
- Custom Setup: We'll help configure your Slack workspace
- Training: Onboarding sessions for your team
Related Resources
- JIRA Integration - Create tickets from alerts
- Webhook Integration - Custom integrations
- API Reference - Full API documentation
- Alerting Guide - Configure alert rules
Ready to connect Slack? Head to your project settings and get started!