Slack Bot Integration (Experimental)

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:

  1. sfp-server must be running (see Setting up sfp server)

  2. Admin access to your Slack workspace

  3. LLM Provider configured (OpenAI or Anthropic) for AI features

Quick Setup

Step 1: Create a Slack App

  1. Visit api.slack.com/apps and click Create New App

  2. Choose From an app manifest

  3. Select your workspace

  4. Use the sfp CLI to generate the manifest:

  1. Copy the generated manifest and paste it in Slack

  2. Review and create the app

Step 2: Configure Tokens

After creating your Slack app:

  1. Navigate to Basic Information > App-Level Tokens

  2. Create a token with connections:write scope

  3. Copy the xapp- token (SLACK_APP_TOKEN)

  4. Go to OAuth & Permissions and copy the Bot User OAuth Token (starts with xoxb-)

  5. 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

  1. In your Slack app settings, go to Install App

  2. Click Install to Workspace

  3. Review and authorize permissions

  4. 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:

Variable
Description
Default

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

  1. Check Socket Mode Connection:

  1. Verify Tokens:

  • Ensure all three tokens are correctly configured

  • Check token scopes match the manifest

  1. Review Logs:

Permission Errors

Ensure the bot has these OAuth scopes:

  • app_mentions:read

  • chat:write

  • im:history

  • im:write

  • reactions:write

AI Features Not Working

  1. Verify LLM provider configuration:

  1. Check API key validity

  2. 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

Last updated