Skip to main content
When a user @mentions a group bot or sends a direct message to the bot, DingTalk forwards the message content to the bot developer’s HTTPS service endpoint. This topic describes the message receiving protocol of the bot.

HTTP header parameters

Developers must verify the timestamp and sign in the header to determine whether the request is a legitimate request from DingTalk. This prevents malicious parties from impersonating DingTalk to call the developer’s HTTPS service and send data. The verification logic is as follows:
  • If the timestamp differs from the current system timestamp by more than 1 hour, the request is considered invalid.
  • If the sign does not match the value calculated by the developer, the request is considered invalid.
Only when both timestamp and sign are verified successfully can the request be considered a legitimate request from DingTalk.

How to calculate the sign

Use the timestamp from the header + “\n” + the bot’s appSecret as the string to sign. Calculate the signature using the HmacSHA256 algorithm, then Base64-encode the result to obtain the final signature value. Sample signature calculation code (Java)

HTTP Body

Parameter description

Supported message types for receiving

Bots currently support receiving text, voice, image, file, video, and rich text messages. The following tables explain the fields for each type of message that the bot receives. Apart from the message type and message body fields, all other parameter fields are the same as in the table above.

Important

  • In a group chat: when group members @mention the bot, the bot does not support receiving voice, file, or video types.
  • In a person-to-person chat: the bot does not support receiving voice, file, or video types.
  • In a person-to-bot chat: the bot supports receiving voice, file, and video types.

Text message

Parameter description:

Voice message

Parameter description:

Image message

Parameter description:

Video message

Parameter description:

File message

Parameter description:

Rich text message

Parameter description:

HTTP response format

Developers can choose to reply with a message based on their business needs. The following five message types are currently supported: text, markdown, overall-jump actionCard, standalone-jump actionCard, and feedCard.