Data Management (DMS) allows you to use custom webhook URLs as a notification method in addition to text messages, emails, DingTalk notifications, and DingTalk chatbot messages.

Configure a webhook URL as a notification method

Configure notification methods in the DMS console. In the Modify notification method dialog box, enter a webhook URL in the webhook field and select webhook next to Notification method.

Modify notification method dialog box

For more information, see Configure notification methods.

Request for an event notification

When notifications are generated in DMS, DMS sends the notifications to the webhook URL that you specify. This section describes the content of a POST request.

Request header

DMS-Event: Message Hook

Request parameters

Parameter Type Description
submitterUid String The ID of the account that submits the task.
submitterName String The name of the account that submits the task.
category String The module to which the task belongs, such as Tickets, Task Orchestration, or Data Warehouse Development.
module String The type of business, such as permission application, data change, schema design, or data export.
event String The event that is triggered by the status of the task, such as pending approval, success, or failure.
taskId String The ID of the ticket or task flow.
taskName String The name of the task.
eventTime String The time when the event occurs.
message String The preset message in DMS.
receivers Array The information about one or more recipients.
uid String The UID of the recipient. The receivers parameter must contain the UID of each recipient.
name String The name of the recipient. The receivers parameter must contain the name of each recipient.

Sample request

{
    "submitterName":"xxx",
    "submitterUid":"167382665015xxxx",
    "category":"Tickets",
    "event":"Precheck failed",
    "message":"Dear DMS users: The ticket submitted by xxx for a data change fails to be prechecked. You can go to the details page of the ticket to check the ticket and submit it again.",
    "Module":"Data change"
    "receivers":[
    {
        "name":"xxx1",
        "uid":"167382665015xxxx"
    },
    {
        "name":"xxx2",
        "uid":"167382665016xxxx"
    }]
}

Sample responses

{"root":"","success":true} // The notification is sent.
{"root":"error message","success":false} // The notification fails to be sent.

Example

You can create an echo script to test a webhook URL and view the notification that is sent by using the webhook URL.

  1. Save the following sample code as a script named print_http_body.rb.
    require 'webrick'
    server = WEBrick::HTTPServer.new(:Port => ARGV.first)
    server.mount_proc '/' do |req, res|
      puts req.body
    end
    trap 'INT' do
      server.shutdown
    end
    server.start
  2. Select a port that is not used, such as Port 8000. Run the script: ruby print_http_body.rb 8000.
  3. In the DMS console, configure a webhook URL as a notification method, such as http://my.host:8000/. For more information, see Configure notification methods.
    If a server is configured to use Basic Authentication over the HTTP protocol, you can access the server by using a webhook URL that contains the username and password. Sample webhook URL:
    http://userName:password@my.host:8080/project/test-job
  4. Submit a data change ticket in DMS. For more information about data changes, see Change regular data. After the ticket is processed, a notification from DMS can be sent to the webhook URL that you specify.

    Sample notification:

    {"category":"Tickets","event":"Precheck failed","message":"Dear DMS users: The ticket submitted by xxx for a data change 
    fails to be prechecked. You can go to the details page of the ticket to check the ticket and submit it again.","module":"Data change","receivers":[{"name":"xxx","uid":"1673826650152166"}],
    "submitterName":"xxx","submitterUid":"1673826650152166"}
    127.0.0.1 - - [20/Apr/2021:20:07:47 CST] "POST / HTTP/1.1" 200 0