How to Integrate with Dify
Overview
Method
Use Case
Description
Integration Architecture
┌─────────────────────────────────────────────────────────┐
│ Dify │
│ ┌─────────────┐ ┌─────────────┐ ┌────────────┐ │
│ │ User │──▶│ Chatflow/ │──▶│ Response │ │
│ │ Input │ │ Workflow │ │ │ │
│ └─────────────┘ └──────┬──────┘ └────────────┘ │
│ │ │
│ ┌──────▼──────┐ │
│ │ HTTP / │ │
│ │ Knowledge │ │
│ └──────┬──────┘ │
└────────────────────────────┼────────────────────────────┘
│
▼
┌──────────────────────────────┐
│ SnackPrompt AI Engine API │
│ /v1/kb/search or /v1/kb/chat│
└──────────────────────────────┘Method 1: External Knowledge API (Recommended)
Step 1: Configure External Knowledge
Step 2: API Configuration
Field
Value
Step 3: Request Configuration
Dify Field
API Response Path
Step 4: Use in Applications
Method 2: HTTP Request in Workflows
Step 1: Create a Workflow
Step 2: Add HTTP Request Node
Field
Value
Step 3: Process Results
Step 4: Generate Response
Method 3: Chat Endpoint for Simple Integration
Workflow Structure
HTTP Request Configuration
Field
Value
Extract Response
Method 4: Custom Tool for Agents
Step 1: Go to Tools
Step 2: Configure Tool
Field
Value
Name
Type
Required
Description
Step 3: Tool Schema
Step 4: Authentication
Field
Value
Step 5: Use in Agent
Practical Use Cases
1. Simple Q&A Chatbot
2. Support Agent with Tools
3. RAG Workflow with Validation
4. Multi-Source Knowledge
5. Conversational RAG with Memory
Configuration Tips
1. Optimize Retrieval Settings
Setting
Recommended Value
2. Tool Description Matters
3. Handle Empty Results
4. Use Variables for Configuration
Variable
Value
5. Filter by Context
Complete Example: Customer Service Chatbot
Application Type
System Prompt
Tools Configuration
Conversation Opener
Troubleshooting
Error: "tenant_id is required"
External Knowledge not returning results
Agent doesn't use the tool
Workflow HTTP request fails
Slow response times
API Response Mapping Reference
Search Endpoint Response
Mapping for External Knowledge
Dify Expects
SnackPrompt Returns
Mapping
Chat Endpoint Response
Related
External Resources
Last updated
Was this helpful?