DingTalk web application deployment

Updated at:

This topic describes how to configure and deploy an Alibaba Cloud Chatbot as a web application in DingTalk and provides solutions to common issues.

Procedure

Create and configure a DingTalk application

  1. A DingTalk administrator creates an application in the DingTalk Open Platform.

    image.png

  2. After you create the application, note the corpId, AppKey, and AppSecret from the application details. You will need this information later when you deploy the channel in Alibaba Cloud Chatbot.

    image

  3. In the DingTalk application, click Add Application Capability > Web Application to add a web application.

    image.png

  4. Configure the web application.

    1. To get the standalone page deployment URL, in the chatbot space of the Alibaba Cloud Chatbot console, navigate to Deployment Channels > Service UI Deployment > Standalone Page Deployment.image

    2. After obtaining the URL, return to the Web Application settings in DingTalk. In the Application Homepage URL and PC Homepage URL fields, paste the standalone page deployment URL and append &corpId=$CORPID$ to the end of the URL. For example, if your standalone page deployment URL is https://chatbot.aliyuncs.com/intl/index.htm?locale=zh-CN&from=xxxx, enter https://chatbot.aliyuncs.com/intl/index.htm?locale=zh-CN&from=xxxx&corpId=$CORPID$ in the fields.

      image

  5. In permission management, grant the following permissions to the application.

    image.png

  6. On the Version management and release page, create a new version and publish it.

    image.png

Configure Alibaba Cloud Chatbot

  1. In the chatbot space, navigate to Deployment Channels > Web Channel > Service UI Deployment > DingTalk H5 Page Deployment and click DingTalk Authorization Management.

  2. Enter the corresponding information from your DingTalk application.

    image

  3. After you confirm, click Bind to Current Channel in the list.

    image

  4. Finally, click Deploy to apply the configuration to the specified environment.

    image

Verify information retrieval

  1. After you complete the steps above, you can find the application in your DingTalk workbench. The application displays the client-side page deployed for the channel. When a user interacts with the chatbot, the system passes their DingTalk account information as passthrough parameters.

    image.png

    The following table lists the passthrough parameters. Note: If a field is empty in a user's DingTalk profile, its value cannot be retrieved.

    Parameter

    Variable

    Description

    ding_name

    name

    Employee's name in the DingTalk organization.

    ding_unionid

    unionid

    Employee's unique ID within the DingTalk organization.

    ding_work_place

    work_place

    Workplace

    ding_email

    email

    Email address

    ding_dept_id_list

    dept_id_list

    Department ID list

    ding_job_number

    job_number

    Employee ID

    ding_hired_date

    hired_date

    Hire date

    ding_title

    title

    Job title

    ding_extension

    extension

    A custom field in DingTalk. For example, if a custom field is named "Custom", you can retrieve its value in the conversation flow by using the expression ${envVars['VENDOR_PARAM']['ding_extension']['Custom']}.

  2. You can then use an API or a multi-turn conversation flow to perform custom actions based on this account information. The following example shows how to retrieve and display the user's account name. After you create and publish the conversation flow and the chatbot, when you enter an utterance for the corresponding intent in DingTalk, the chatbot displays the user's DingTalk account name.

    image.png

  3. In DingTalk, find the application and ask it a question. Verify that the response correctly includes the user information.

    image.png

Other configurations

Configure Q&A perspectives

When the chatbot responds to a message, you may want to provide personalized answers based on the user's identity. By configuring different perspectives in your knowledge base, the chatbot can automatically select the appropriate answer for each user. To set a perspective for a specific user in DingTalk, follow these steps:

  1. In the DingTalk admin console, go to Member Information Management and add a custom field.image

  2. Configure a perspective. For more information, see Perspective Management. Obtain the perspective code, for example, FJnby7YfJf.

  3. In the DingTalk admin console, enter the perspective code for the user.

    • Method 1: Go to Member Management, select a member, and click More > Edit Member Information > Fill in More Information, then enter the Perspective code.image

    • Method 2: Export member data in bulk, fill in the perspective code for each member, and then import the file.

FAQ

Q: Security verification and missing user information

A: When you configure the application in DingTalk, do not specify the server egress IP.image