This topic uses specific examples to demonstrate how the DingTalk open platform leverages Alibaba Cloud Function Compute and EventBridge to create secure, high-availability, and lightweight data interconnections between applications. This enables official DingTalk applications, third-party applications, and proprietary enterprise systems to implement event-driven data flows.
What is a DingTalk connector?
The DingTalk application center features numerous mini programs and H5 applications developed by Independent Software Vendors (ISVs). Seamless data exchange with other applications or internal enterprise systems requires a standardized, event-driven data model. DingTalk connectors address these application integration and business automation challenges.
Customer cases
The following DingTalk ISVs are currently using DingTalk connectors, with more being onboarded. You are welcome to try them.
Integrated ISVs include Xbongbong CRM, Ekuaibao, Jinzhi CRM, Youcheng CRM, Dougong Cloud Engineering, BOSS accounting, and Antbim, all of which support both mobile and PC clients.
For example, consider Xbongbong CRM, a mobile SaaS provider for enterprises. Its end users need to synchronize data, such as new customer records, product updates, and contract changes, to another SaaS application, BOSS accounting (an intelligent financial software). In this scenario, Xbongbong CRM is the trigger application, BOSS accounting is the execution application, and activities such as customer, product, or contract changes are the trigger events.
The ISV of the trigger application (the data provider)—in this case, Xbongbong CRM—creates the connector. Enterprise users can then create a connection (an EventBridge rule) for this connector to synchronize data from Xbongbong CRM. Users configure the destination by setting up an execution action (an EventBridge target) within the connection. In this example, the execution action is the event-receiving service of BOSS accounting. DingTalk ISVs can pre-register their execution actions on the platform or host them on Function Compute, connecting to EventBridge through event triggers or the HTTP protocol.
Take the example of Xbongbong CRM sending data to BOSS accounting. The customer and order data sent by Xbongbong CRM and received by BOSS accounting use the same customer data model and order/contract data model. When Xbongbong CRM calls the connector's event sending API, the connector synchronously transforms the data into the standard CloudEvents protocol format, enabling BOSS accounting to complete the integration by performing only simple format mapping.
Configure Function Compute as an execution action
DingTalk officially supports popular templates for applications like Xbongbong CRM, BOSS accounting, Dougong Cloud, Ekuaibao, Youcheng Finance, Jinzhi CRM, and Antbim. Supported trigger events include customer changes, product updates, contract changes, and EKB-triggers. Third-party service providers can use the integration platform and adhere to master data standards to connect business and finance applications on DingTalk. The platform provides data conversion tools, reducing the cost for service providers to register APIs and use master data.
Function Compute serves as the backend service for execution actions in self-built connectors, third-party connectors, and web applications. It enables DingTalk ISVs to quickly build data conversion pipelines for popular applications without managing any underlying infrastructure. You only need to handle data format mapping and custom business logic.
Follow these steps:
-
Log on to the DingTalk open platform.
-
Create an application.
Before developing an internal enterprise application, you must first create one and complete its basic configuration.
-
Create a self-built connector.
This connector is for internal enterprise use, allowing you to configure data models and execution actions, such as customer change events in Xbongbong CRM.
Example: In the connector workbench, select fc (Function Compute) as the trigger application. On the Select execution application panel, select Network Request for the application, and select Send Network Request for the execution action. Enter the target URL (for example,
https://xxx.com) in the URL field. Select POST as the request method. For the body, enter the JSON data, which includes variable references to event fields such as${$.data.event_id},${$.data.event_name}, and${$.data.event_content}. -
Create a custom application connection.
An application connection consists of a trigger application and an execution application. The trigger application can be a self-built or third-party application. The execution application can be a self-built application, a third-party application, an internal enterprise application, or a bot. By combining different trigger and execution applications, enterprises integrate applications for various scenarios.
Configure Function Compute as a connector target
Function Compute provides templates for applications such as Xbongbong CRM, BOSS accounting, Dougong Cloud, Ekuaibao, Youcheng Finance, Jinzhi CRM, and Antbim. It can also act as the event trigger target for custom connectors, hosting backend code for DingTalk ISVs to enable a fully automated and standardized process.
The following example shows how to use EventBridge with Function Compute to implement a custom connector: In the Function Compute console, select the target service and function, and then click the Code Execution tab. For the upload method, select Online Edit. In the code editor, write the code for an http trigger function. The function uses exports.handler to receive HTTP requests. It extracts parameters such as path, queries, headers, method, requestURI, clientIP, and body from the request. After retrieving the request body with getRawBody, the function serializes all parameters into a JSON string and returns it with resp.send. This enables the function to receive and transform event data from the connector.
Debugging DingTalk connectors
ISVs can convert data-sending operations into EventBridge trigger events, use the CloudEvents protocol to stream data, and trigger target functions.
For more information, see Send connector events.
The following example shows how to debug in API Explorer:
-
Sample code: In API Explorer, select the
/connector/trigger/send_v2API. Fill in the request parameters: access_token, trigger_msg_request (set test tofalse), and trigger_msg_data_list (containing fields such as trigger_id, dd_event_time, and json_data). The panel on the right shows SDK sample code in languages like Java, PHP, Python, and .NET. The example constructs a request by usingDefaultDingTalkClient, sets theTriggerMsgRequestandTriggerMsgDataparameters, and then executes the call. -
Debugging result: Call the
/connector/trigger/send_v2API in the DingTalk open platform API Explorer. The request parameters areaccess_token, thetrigger_msg_requestobject (with thetestvalue set to false), andtrigger_msg_data_list(containingtrigger_id,dd_event_time, andjson_data). The debugger returns a "Status 200 OK" response with anerrcodeof 0 and anerrmsgof "ok", which confirms the API call was successful.