@xpert-ai/plugin-dingtalk provides two integration types:
Default recommendation: use DingTalk Stream mode (
dingtalk_long). It connects outbound from Xpert AI to DingTalk Stream service and does not require external networks to access Xpert AI directly. Use DingTalk HTTP mode (dingtalk) only when Stream mode cannot be used. HTTP mode requires a public callback URL and matching callback Token/AES Key in DingTalk console.
Prepare the DingTalk app
- Log in to DingTalk Open Platform.
- Create an internal enterprise app.
- Enable bot capability.
- Copy app credentials:
- AppKey, filled as
Client ID (AppKey)in Xpert AI. - AppSecret, filled as
Client Secretin Xpert AI.
- AppKey, filled as
- Copy Robot Code from app bot settings.
- If you need user selectors or the
dingtalk_list_userstool, grant department member read permission.
1. Stream mode setup
Stream mode uses a DingTalk long connection to receive bot messages and card callbacks. It does not require a public HTTP callback URL.Create Stream integration in Xpert AI
Go to Settings -> System Integrations and create a DingTalk Stream mode integration.
Integration testing probes the DingTalk Stream connection and returns:
mode=long_connection- subscribed topic
/v1.0/im/bot/messages/get - subscribed topic
/v1.0/card/instances/callback probe.connectedprobe.lastError
Status page
The DingTalk integration detail page provides a Status tab with:- connection mode
- status
- bot / integration name
- Stream subscriptions
- last connected time
- last disconnected time
- last callback time
- recent error
- reconnect count
2. HTTP mode setup
HTTP mode receives bot messages and card callbacks through DingTalk callback URL. It is suitable only when Stream mode cannot be enabled but you already have a public API address.Create HTTP integration in Xpert AI
Go to Settings -> System Integrations and create a DingTalk HTTP mode integration.
After a successful test, Xpert AI returns the callback URL:
Configure DingTalk console
- In DingTalk Open Platform, open app event/callback or bot message push settings.
- Select HTTP push as the receiving mode.
- Fill in the callback URL returned by Xpert AI.
- Keep DingTalk Token/AES Key consistent with Xpert AI integration config.
- Subscribe to bot message events and card callback events.
GET /api/dingtalk/webhook/<integrationId> reachability checks. If the integration exists and HTTP callback is enabled, it returns plain text success.
3. Bind a Digital Expert
After creating the integration:- Open the target Digital Expert workflow.
- Add DingTalk Trigger.
- Select the DingTalk integration you created.
- Configure session timeout and message aggregation.
- Publish the Digital Expert.
4. Message and reply capabilities
DingTalk integration and trigger support:- receiving direct chat and group messages
- processing group messages that mention the bot
- sending text, Markdown, and card replies through DingTalk context
- handling card callbacks, such as ending a session
- proactive notification tools such as
dingtalk_send_text_notification,dingtalk_send_rich_notification,dingtalk_update_message, anddingtalk_recall_message dingtalk_list_userswhen the app has department member read permission
FAQ
Stream mode cannot connect
Check:- Client ID/AppKey and Client Secret are correct.
- Robot Code comes from the same app.
- The server can access DingTalk Stream service.
- The app has bot capability enabled and has been published if required.
- The integration is bound to a published DingTalk Trigger.
HTTP callback verification failed
Check:API_BASE_URLis a public HTTPS address reachable from DingTalk.- The reverse proxy forwards
/api/dingtalk/webhook/<integrationId>. - DingTalk console Token/AES Key match integration
Callback TokenandCallback AES Key. - The integration is DingTalk HTTP mode, not Stream mode.