Slack Bot Integration (Experimental)
This feature is experimental and currently in alpha. The API and configuration may change in future releases.
The sfp-server includes an AI-powered Slack bot that enables teams to interact with their Salesforce DevOps workflows through natural language conversations. The bot provides real-time insights into builds, releases, environments, and can execute sfp commands directly from Slack.
Overview
The Slack bot integration uses Slack's Bolt framework with Socket Mode for secure, bidirectional communication. It features:
Natural Language Processing: Ask questions in plain English
Real-time Status Updates: Get build, release, and environment information
Thread Context: Maintains conversation history for contextual responses
AI-Powered Assistance: Leverages LLM providers for intelligent responses
Prerequisites
Before setting up the Slack bot:
sfp-server must be running (see Setting up sfp server)
Admin access to your Slack workspace
LLM Provider configured (OpenAI or Anthropic) for AI features
Quick Setup
Step 1: Create a Slack App
Visit api.slack.com/apps and click Create New App
Choose From an app manifest
Select your workspace
Use the sfp CLI to generate the manifest:
sfp server slack manifest
Copy the generated manifest and paste it in Slack
Review and create the app
Step 2: Configure Tokens
After creating your Slack app:
Navigate to Basic Information > App-Level Tokens
Create a token with
connections:write
scopeCopy the
xapp-
token (SLACK_APP_TOKEN)Go to OAuth & Permissions and copy the Bot User OAuth Token (starts with
xoxb-
)From Basic Information, copy the Signing Secret
Step 3: Configure sfp-server
Run the interactive setup wizard:
sfp server slack setup
This will guide you through:
Entering your Slack tokens
Configuring the AI provider (optional)
Testing the connection
Alternatively, set environment variables manually:
# Required for Socket Mode
export SLACK_APP_TOKEN="xapp-your-app-token"
export SLACK_SIGNING_SECRET="your-signing-secret"
export SLACK_BOT_TOKEN="xoxb-your-bot-token"
# Optional - for AI features
export OPENAI_API_KEY="your-openai-key"
# OR
export ANTHROPIC_API_KEY="your-anthropic-key"
Step 4: Install to Workspace
In your Slack app settings, go to Install App
Click Install to Workspace
Review and authorize permissions
The bot should now appear in your workspace
Usage
Natural Language Queries
Mention the bot (@codev
or your configured name) with questions:
@codev what's the status of the latest build for sf-core?
@codev show me recent releases for the sales domain
@codev list all active environments
Direct Messages
Send direct messages to the bot for private interactions:
What packages failed validation today?
Show me the deployment history for UAT
Example Interactions
Build Status
User: @codev build status for my-repo
Bot: 📊 Latest builds for my-repo:
✅ Build #123 - Completed (10 min ago)
🔄 Build #124 - In Progress (started 2 min ago)
Release Information
User: @codev recent releases for sales domain
Bot: 📦 Recent releases for sales:
• v2.1.0 - Deployed to PROD (2 days ago)
• v2.0.9 - Deployed to UAT (5 days ago)
Configuration Options
Docker Compose Configuration
When using Docker Compose, add these environment variables to your .env
file:
# Slack Configuration
SLACK_APP_TOKEN=xapp-your-token
SLACK_SIGNING_SECRET=your-signing-secret
SLACK_BOT_TOKEN=xoxb-your-bot-token
# Optional AI Configuration
AI_PROVIDER=openai
OPENAI_API_KEY=your-api-key
Advanced Configuration
The bot behavior can be customized through environment variables:
SLACK_LOG_LEVEL
Logging verbosity (debug, info, warn, error)
info
SLACK_APP_NAME
Display name for the bot
codev
AI_MODEL
Specific AI model to use
Provider default
AI_TIMEOUT
Timeout for AI responses (ms)
30000
CLI Commands
sfp provides several commands to manage the Slack integration:
Setup Wizard
sfp server slack setup [--manual] [--skip-test]
Check Status
sfp server slack status
Test Connection
sfp server slack test
Update Configuration
sfp server slack update --token <token-type> --value <token-value>
List Workspaces
sfp server slack list
Generate Manifest
sfp server slack manifest [--name <app-name>]
Troubleshooting
Bot Not Responding
Check Socket Mode Connection:
sfp server slack status
Verify Tokens:
Ensure all three tokens are correctly configured
Check token scopes match the manifest
Review Logs:
sfp server logs --service api --tail 100
Permission Errors
Ensure the bot has these OAuth scopes:
app_mentions:read
chat:write
im:history
im:write
reactions:write
AI Features Not Working
Verify LLM provider configuration:
sfp ai auth --provider <provider>
Check API key validity
Ensure sufficient API credits/quota
Limitations
Workspace Limit: Currently supports single workspace configuration
Rate Limits: Subject to Slack API rate limits
Context Window: AI responses limited by LLM context window
Command Execution: Some sfp commands may timeout in Slack's 3-second limit
Next Steps
Configure SAML Authentication for enhanced security
Set up Webhook notifications for additional alerting
Review API Reference for programmatic access
Last updated