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:
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:writescopeCopy 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:
This will guide you through:
Entering your Slack tokens
Configuring the AI provider (optional)
Testing the connection
Alternatively, set environment variables manually:
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:
Direct Messages
Send direct messages to the bot for private interactions:
Example Interactions
Build Status
Release Information
Configuration Options
Docker Compose Configuration
When using Docker Compose, add these environment variables to your .env file:
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
Check Status
Test Connection
Update Configuration
List Workspaces
Generate Manifest
Troubleshooting
Bot Not Responding
Check Socket Mode Connection:
Verify Tokens:
Ensure all three tokens are correctly configured
Check token scopes match the manifest
Review Logs:
Permission Errors
Ensure the bot has these OAuth scopes:
app_mentions:readchat:writeim:historyim:writereactions:write
AI Features Not Working
Verify LLM provider configuration:
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