This integration allows you to manage and operate your Alibaba Cloud resources from your DingTalk application.
Prerequisites
-
You have imported an OpenAPI MCP Server in Model Studio.
-
You have added the OpenAPI MCP Server to an application in Model Studio and completed debugging.
Create a DingTalk application
This section uses an in-house application as an example.
To create a DingTalk application, your DingTalk account must have developer permissions. Contact your organization's administrator to obtain these permissions for the DingTalk Open Platform. For more information, see Get Developer Permissions.
-
Go to the DingTalk Open Platform. On the Develop page, select DingTalk App and click Create App in the upper-right corner. If you already have an application you can use, you can skip this step.
-
Grant the application permission to send card messages.
In the navigation pane on the left, select Permission Management. In the search box, enter
Card.Streaming.WriteandCard.Instance.Writerespectively, and click Request Permission in the Actions column. -
Obtain the application's Client ID and Client Secret.
In the navigation pane on the left, select Credentials & Basic Information. On this page, you can find the application's Client ID and Client Secret.
Create a DingTalk Message Card
The DingTalk bot streams results by using Message Cards. To send these messages, you must create a card template.
-
Go to the Card Platform, click Create a Template, and fill in the template information.
Parameter
Description
Card type
Select Message Card.
Card template scenario
Select AI Card.
Associated app
Select the DingTalk application you created in the previous step.
Create from template
Do not select a preset template.
In the Template Name field, enter
mcp-template, and then click Create. -
On the visual editor page, do not modify any settings. Click Save and then Publish. After the template is published, click Back.
-
Obtain the template ID.
In the navigation pane on the left, choose Template Management > Template List. Find your target card template (for example, mcp-template). At the bottom of the card, view and copy the Template ID.
Publish the Model Studio application to DingTalk
After you publish the Model Studio application, you can publish it to DingTalk.
-
Click the Publishing Channels tab at the top of the application, and then click DingTalk Bot.
NoteIf this is your first time using a DingTalk bot, you must complete the authorization process first.
-
Follow the configuration wizard to select your API KEY and enter the DingTalk template ID, DingTalk Client ID, and DingTalk Client Secret.
-
After the DingTalk channel is created, you can view the callback address for the DingTalk bot.
Configure the DingTalk bot
-
Go to your DingTalk application list. Find the application you just created and click its name to open the details page.
-
In the navigation pane on the left, select Add Application Capabilities, and then click Add Bot.
-
Enable the Bot Configuration switch and fill in the bot's information.
Parameter
Description
Message receiving mode
Select HTTP Mode.
Message receiving address
The callback address obtained from the Model Studio publishing channel.
Publish the DingTalk application
After you configure the application, you must publish a version to make it available to other users in your organization. In the navigation pane on the left, select Version Management & Publishing and click Create New Version in the upper-right corner. On the version details page, enter the App Version Number and Version Description, and select an appropriate visibility scope for the application. Click Save, and then click Publish Now in the dialog box.
Test the bot
You can add the bot to a new or existing group chat and interact with it to see the results.
-
Add the bot in the DingTalk group settings.
In the DingTalk group, go to the Group Settings page and click Bots. On the Bot Management page, click Add Bot.
-
Mention the bot in the DingTalk group to interact with it.
For example, after you send the command
Deploy a dify instance in China (Hong Kong), the bot returns a deployment report. This report contains instance information (instance name:dify-deployment-instance, instance type:ecs.c9i.xlarge, system disk: 40 GB cloud_essd, availability zone:cn-hongkong-b, operating system: CentOS 7.9 64-bit, public and private IPs) and network configurations, such as the VPC, VSwitch, and a security group with ports HTTP (80), HTTPS (443), and SSH (22) open.