DingTalk Integration Guide
This guide provides detailed instructions for configuring DingTalk IM channel integration in Wegent.
π Table of Contentsβ
- Prerequisites
- Step 1: Create DingTalk Application
- Step 2: Configure Application Permissions
- Step 3: Get Application Credentials
- Step 4: Enable Message Stream Mode
- Step 5: Configure IM Channel in Wegent
- Step 6: Verify Connection
- Step 7: Test the Integration
- DingTalk-Specific Features
- Troubleshooting
- Related Resources
β Prerequisitesβ
Before setting up DingTalk integration, ensure you have:
- DingTalk Enterprise account with admin access
- Access to DingTalk Open Platform
- Wegent instance with admin privileges
- At least one configured Agent (Team) in Wegent
π§ Step 1: Create DingTalk Applicationβ
- Log in to DingTalk Open Platform
- Navigate to Application Development β Enterprise Internal Application
- Click Create Application
- Fill in application details:
- Application Name: Your bot name (e.g., "Wegent AI Assistant")
- Application Description: Brief description of the bot's purpose
- Application Icon: Upload an appropriate icon
π Step 2: Configure Application Permissionsβ
Enable the following permissions for your application:
Robot Permissions:
qyapi_robot_sendmsg- Send robot messagesqyapi_chat_manage- Manage group chats
AI Card Permissions (for streaming responses):
Card.Instance.Write- Create and update AI card instancesCard.Streaming.Write- Stream write AI card content
User Information Permissions:
Contact.User.Read- Read user informationContact.User.mobile- Access user mobile (optional)
π‘ Note: AI Card permissions are required for streaming response effects. Without these permissions, the bot will not be able to use AI Card features and will fall back to plain text message mode.
π Step 3: Get Application Credentialsβ
- In your application settings, navigate to Credentials and Basic Info
- Copy the following values:
- Client ID (AppKey)
- Client Secret (AppSecret)
β οΈ Security Note: Keep your Client Secret secure. Never share it or commit it to version control.
π Step 4: Enable Message Stream Modeβ
- In application settings, go to Robot Configuration
- Enable Message Receiving Mode: Stream Mode
- This allows Wegent to receive messages via WebSocket without configuring callback URLs
βοΈ Step 5: Configure IM Channel in Wegentβ
- Log in to Wegent as an administrator
- Navigate to Admin Panel β IM Channels
- Click Add Channel
- Fill in the configuration:
| Field | Description | Example |
|---|---|---|
| Channel Name | Display name for this channel | "DingTalk Bot" |
| Channel Type | Select platform | DingTalk |
| Client ID | From Step 3 | dingxxxxxxxx |
| Client Secret | From Step 3 | xxxxxxxxxxxxxxxx |
| Default Agent | Agent to handle messages | Select from list |
| Default Model | Override model (optional) | Leave empty to use agent's default |
| Enable AI Card | Use streaming AI Card | β Recommended |
- Click Save to create the channel
- Toggle Enable to activate the channel
βοΈ Step 6: Verify Connectionβ
- Check the channel status in the IM Channels list
- Status should show Connected (green indicator)
- View uptime and last error information if available
π§ͺ Step 7: Test the Integrationβ
- Open DingTalk and find your bot
- Send a test message: "Hello"
- Verify you receive an AI response
π¨ DingTalk-Specific Featuresβ
Group Chat Botβ
Add the bot to DingTalk group chats:
- In the group chat, click Group Settings β Smart Group Assistant
- Click Add Robot
- Select your created robot
- The bot can now respond to @mentions in the group chat
Direct Message Botβ
Users can chat with the bot directly:
- Search for the bot name in DingTalk
- Click on the bot card
- Start the conversation
AI Card Streamingβ
DingTalk AI Cards provide a rich streaming response experience:
- Display content being generated in real-time
- Support Markdown formatting
- Code block syntax highlighting
- Collapsible long content
β Troubleshootingβ
Connection Issuesβ
Channel shows "Disconnected"β
Possible causes:
- Invalid Client ID or Client Secret
- Network connectivity issues
- DingTalk API service disruption
Solutions:
- Verify credentials in DingTalk Open Platform
- Check network connectivity from Wegent server
- Try restarting the channel
- Check DingTalk service status
Messages not being receivedβ
Possible causes:
- Stream mode not enabled in DingTalk
- Robot permissions not configured
- Channel not enabled in Wegent
Solutions:
- Verify Stream Mode is enabled in DingTalk app settings
- Check all required permissions are granted
- Ensure channel is enabled (toggle is on)
Response Issuesβ
Bot not respondingβ
Possible causes:
- Default Agent not configured
- Agent has no model assigned
- Rate limiting
Solutions:
- Verify a default Agent is selected for the channel
- Ensure the Agent has a working model configuration
- Check for rate limit errors in channel status
Slow or incomplete responsesβ
Possible causes:
- AI Card streaming issues
- Network latency
- Large response content
Solutions:
- Try disabling AI Card streaming temporarily
- Check network connectivity
- The system will fall back to sync mode if streaming fails
User Issuesβ
User not recognizedβ
Possible causes:
- User mapping configuration issues
- DingTalk user info not accessible
Solutions:
- Check user permissions in DingTalk app
- Verify user mapping configuration
- Contact administrator for enterprise user mapping
User creation failedβ
Possible causes:
- Missing
Contact.User.Readpermission - Failed to retrieve DingTalk staff ID
Solutions:
- Ensure permission to read user information is granted
- Re-authorize application permissions
- Check if DingTalk user is in the enterprise organization
π Related Resourcesβ
Wegent Documentationβ
- IM Channel Integration Overview - General IM integration concepts and features
- Agent Settings - Configure agents for IM channels
- Configuring Models - Set up AI models
DingTalk Official Resourcesβ
- DingTalk Open Platform Documentation
- DingTalk Stream Mode Guide
- DingTalk Robot Development Guide
- Enterprise Application Development Guide
Get Helpβ
- π Check Wegent FAQ
- π Submit GitHub Issue
- π¬ DingTalk Open Platform Technical Support
Connect your AI agents to DingTalk and empower your team! π