Skip to main content

Create and Configure a Message Template

  1. Sign in to the Developer Console.
  2. Click App Development, select Third-party enterprise app, and create a mini program or an H5 micro app.
  3. On the app details page, click Message Push. In the message template management area, click Add.
  4. Select a template type and click Create.
  5. Configure the message template and click Save. Important If template parameters are configured in the template, they are automatically loaded below, and you can then configure the description of each dynamic parameter. Some values in the message content change dynamically, such as order numbers, phone numbers, and product names. These values cannot be determined when you set up the template, so you can use template parameters to substitute them.
  6. Click Test, then click Send Test Message to verify that the message template is configured correctly.

Configure a Markdown Template

A Markdown template uses Markdown syntax to configure and send messages. It applies to pure notification messages that require no action. With a Markdown template, you can easily support display formats such as text, images, and links. Markdown Message Template Configuration Markdown Syntax:

ActionCard Template

An ActionCard template sends messages of the ActionCard message type. It supports messages that combine message content with action points, and applies to scenarios where one or more action points in the message are required for quick handling. Based on the Markdown template, the ActionCard template supports both overall redirect and independent redirect styles. ActionCard Template Configuration

Form Template

A Form template sends messages based on the OA message type. It applies to displaying messages such as orders, and supports redirecting to view message details. Form Message Template Configuration

Configure Template Parameters

Some values in the message content change dynamically, such as order numbers, phone numbers, and product names. These values cannot be determined when you set up the template, so you can use template parameters to substitute them. Pass in the actual values to replace the template parameters when you send Work Notifications. Template parameters are optional and can be configured based on your needs. Format of Template Parameters Template parameters use the format ${parameter name}. Parameters must comply with the following specifications.
  • Must start with a letter or an underscore.
  • The remaining part can consist of letters, underscores, and numbers.
  • Do not set too many dynamic parameters for a single message. No more than 5 is recommended.
For example, the message content is as follows:
Here, ${product} is a template parameter with the parameter name product. Simply pass in the value of this parameter when sending the message. For example, pass in product as “Disposable Masks” when sending the message. Then “Disposable Masks” replaces the ${product} template parameter, and the message content the user finally receives is as follows:
A message template can have several template parameters configured, or no template parameters at all. Set them based on your actual needs. ID Translation When passing in dynamic parameters, ID translation is supported. Currently, it supports converting a department ID to a department name and converting a userId to a user name. The ID translation syntax is as follows:
Here:
  • DEPARTMENT_ID is the numeric department ID.
  • USERID is the user’s user ID.
For example:
  • Replace departmentName=100departmentName=100 with the department name corresponding to the department ID “100”, such as “DingTalk Open Platform”.
  • Replace userName=zhangsan01userName=zhangsan01 with the user name corresponding to the user ID “zhangsan01”, such as “John”.

Submit for Review

After creating a message template, click Submit to submit the template for review.

Enable a Template

After the template passes the review, it is enabled automatically. When a message template is enabled, you can send template messages by calling the API. For details, see Use a Template to Send Work Notification Messages.

Disable a Template

When you no longer need a template, turn off the enable toggle to stop using the template.

Delete a Template

Click Delete to delete a template.

Clone a Template

Click Clone to copy a template with the same configuration.

Test a Template

After clicking Edit, you enter the template editing interface. Click the Test button on the template editing page to run a test. The test sends a Work Notification to yourself.