Configure a DingTalk chatbot to send alert notifications

更新时间:
复制 MD 格式

To configure a pipeline to send notifications to a DingTalk group in the R&D process, you must add a custom DingTalk chatbot in advance and obtain the webhook URL of the DingTalk chatbot for subsequent configurations.

Add a DingTalk chatbot and obtain the WebHook URL

  1. Go to the pipeline editing page. For more information, see Create custom pipeline phases.

  2. Run the DingTalk client on a PC, go to the DingTalk group to which you want to add an alert chatbot, and then click the Group Settings icon in the upper-right corner.

  3. In the Group Settings panel, click Group Assistant. Then, click Add Robot.

    67E16226-7D19-490C-AA43-32B4668A1DC1

  4. In the ChatBot dialog box, click the gear icon next to Add Robot. Then, click Custom.

  5. In the Robot details dialog box, click Add. The Add Robot dialog box appears.

  6. Specify information about the DingTalk chatbot. Parameter configuration:

    • By default, Add to Group is set to the current group and cannot be modified.

    • Select Custom Keywords for Security Settings and enter the keyword DevOps.

      After you specify custom keywords, messages are sent only if these messages contain the specified keywords.

      Screenshot

      Important

      The keywords are case-sensitive. Invalid keywords can cause mismatches.

  7. Read the terms of service, select I have read and accepted <<DingTalk Custom Robot Service Terms of Service>>, and then click Finished.

    You can obtain the webhook URL of the custom DingTalk chatbot to push messages to the DingTalk group.

    Add Robot

Configure pipeline run result notifications

  1. On the pipeline editing page, click the Pipeline Run Result Notification section. Then, the Phase Configuration panel appears.

  2. In the Phase Configuration panel, turn on Switch next to the Phase Configuration page title to allow notifications to be sent to a DingTalk group, and then configure other parameters.

    The following table describes the parameters that are used to configure the phase information.

    Parameter

    Description

    Phase Name

    The default value is Pipeline Run Result Notification and cannot be modified.

    Timeout Period

    The maximum execution time of this phase. Unit: minutes. The default value is 10 minutes. If the execution time of this phase exceeds the preset value, the execution fails.

    Runtime Environment Required

    The default value is No and cannot be modified.

    Image

    The default value is agentless and cannot be modified.

    Execution Timing

    The circumstances under which this phase is executed.

    • Execute only After All Preceding Tasks Succeed

    • Execute only After All Preceding Tasks Fail

    • Unconditional Execution: This stage is executed regardless of whether all preceding tasks succeed or fail.

    Default value: Unconditional Execution.

  3. In the Task Steps section, click Add Step. In the dialog box that appears, select DingTalk Notification for Pipeline Result.

Screenshot

4. Configure a task to send notifications to a DingTalk group.

Parameter

Description

Step Name

The name of this phase.

Enable

Specifies whether to enable this phase. This phase is enabled by default. If Enable is set to Yes, subsequent options take effect.

Timeout Period

The maximum execution time of this task. The default value is 60 minutes. If the execution time of the task exceeds the preset value, the execution fails.

Execution Timing

The circumstances under which this phase is executed.

  • Execute only After All Preceding Tasks Succeed

  • Execute only After All Preceding Tasks Fail

  • Unconditional Execution: This stage is executed regardless of whether all preceding tasks succeed or fail.

DingTalk Webhook URL

The webhook URL of the DingTalk group.

Important

Webhook URLs are sensitive information. Keep the information confidential. Leaks of such information may cause security risks.

5. Click OK to save the DingTalk group notification settings.