How to Create a Dify Slack Bot
Table of Contents
Background #
Our company has two products with steep learning curves due to their extensive features. New employee training takes significant time, and customer support staff often struggle with complex issues, requiring time-consuming consultations.
Last year, we implemented a Dify-based chatbot for customer service. By importing product documentation into its knowledge base, agents could query the bot directly - saving considerable time. However, requiring agents to access Dify’s web interface remained inconvenient.
Since we use Slack for internal communication, we wanted to integrate the Dify bot into Slack for direct querying.
With a recently purchased Mac mini in our office, we installed Dify locally. By configuring two apps in our Slack workspace and connecting them to our local Dify instance, we achieved this integration!
We chose local Dify deployment because enterprise-level usage requires either a paid Dify account or self-hosting. Given our resources and Dify’s open-source nature, self-hosting was the optimal choice.
Final Implementation #
Configuration Guide #
Configure Dify Customer Service Chatbot #
Dify is an open-source LLM application development platform offering:
- Extensive model support
- Intuitive prompt engineering interface
- High-quality RAG engine
- Robust Agent framework
- Flexible workflow orchestration
- User-friendly UI and APIs
For local deployment, refer to the official Dify documentation
Create Customer Service Bot #
- Click “Create Application” after login
- Select “Conversational Application” type
- Configure in prompt engineering interface:
- System prompt example: “You are a professional customer service assistant capable of accurately answering product usage questions based on knowledge base content”
- Upload product documentation to knowledge base
- Enable “Text Generation” model
- Save configuration for Slack API integration
Create Slack App #
- Visit Slack API Platform
- Create Slack App using manifest method and select target workspace:
display_information:
name: your bot name
features:
bot_user:
display_name: your bot name
always_online: false
oauth_config:
scopes:
bot:
- app_mentions:read
- im:history
- incoming-webhook
- im:write
- chat:write
- channels:join
settings:
event_subscriptions:
bot_events:
- app_mention
- message.im
interactivity:
is_enabled: true
org_deploy_enabled: false
socket_mode_enabled: true
token_rotation_enabled: false
- Apply the manifest configuration
- Obtain App-Level Token and Auth Token from app settings
Connect Dify App with Slack using Bot Plugin #
- Follow Dify’s official Slack bot plugin tutorial
- Recommended open-source solution: Dify-bot by crazywoola
- Configure plugin according to its documentation
Testing & Deployment #
- After successful testing, announce availability to team 🎉