Request
Basic information
| Field | Value |
|---|---|
| HTTP URL | https://api.dingtalk.io/v1.0/robot/privateChatMessages/query |
| HTTP Method | POST |
| Supported app types | appType-Internal app appType-Third-party enterprise app |
| Required permissions | permission-qyapi_robot_sendmsg-Permission for Bots in your organization to send messages |
Request headers
| Name | Type | Required | Description |
|---|---|---|---|
| x-acs-dingtalk-access-token | String | Yes | The access credential for calling this API. Obtain it as follows: - For internal apps, call the Obtain the access token of an internal app API. - For third-party enterprise apps, call the Obtain the access token of an authorized organization for a third-party app API. |
Request body
| Name | Type | Required | Description |
|---|---|---|---|
| openConversationId | String | No | The open conversation ID for the one-to-one chat. Obtain its value by calling Batch install a Mini App into direct message chats and subscribing to Chat management events to get the OpenConversationId. |
| robotCode | String | No | The Bot code. For details, see Bot ID. |
| processQueryKey | String | Yes | The message ID. Obtain the processQueryKey value by calling the Create and deliver a card API or the Send a plain message via a Bot in a one-to-one chat API. |
| maxResults | Long | No | The number of items per page in a paginated query. |
| nextToken | String | No | The encrypted pagination credential returned from the previous query. Leave this empty for the first query. |
Request example
HTTPResponse
Response body
| Name | Type | Description |
|---|---|---|
| sendStatus | String | The message send status. - SUCCESS: Sent successfully. - RECALLED: Recalled. - PROCESSING: In progress. |
| readUserIds | Array of String | The list of userIds of users who have read the message. |
| nextToken | String | The encrypted credential for the next paginated query. |
| hasMore | Boolean | Indicates whether more results are available for the paginated query. |
Response body example
Error codes
If an error occurs when calling this API, refer to the Global error codes document to find a solution based on the error message.| HttpCode | Error code | Error message | Description |
|---|---|---|---|
| 400 | invalidParameter.param.invalid | Invalid parameter | Invalid parameter. Check whether the parameter is empty. |
| 400 | invalidParameter.robotCode.notExsit | Bot does not exist | The Bot does not exist. Check whether the Bot is in the group. |
| 400 | invalidParameter.robotCode.missing | Missing robotCode | Missing robotCode. |
| 400 | invalidParameter.processQueryKey.missing | Missing processQueryKey | Missing processQueryKey. |
| 400 | invalidParameter.cursor.invalid | Invalid nextToken | Invalid nextToken. Check whether nextToken is correct. |
| 400 | invalidParameter.pageSize.invalid | Invalid maxResults | maxResults exceeds the upper limit of 200. |
| 400 | invalidParameter.robotCode.invalid | Invalid robotCode | Invalid robotCode. |
| 400 | invalid.openConversationId | Invalid openConversationId | Invalid openConversationId. |
| 400 | openConversationId.notExisted | openConversationId is empty | openConversationId is empty. |
| 400 | invalid.processQueryKey | Invalid processQueryKey | Invalid processQueryKey. |
| 400 | bot.stopped | The Group bot has been disabled | The Group bot has been disabled. |
| 400 | template.not.existed | Bot template does not exist | The Bot template does not exist. |
| 400 | template.stopped | Bot template has been disabled | The Bot template has been disabled. |
| 400 | processQueryKey.expireTime | processQueryKey has not yet generated message query data or has expired | processQueryKey has not yet generated message query data or has expired. The message cannot be queried. |
| 400 | conversation.org.dismatch | The chat does not belong to the current organization | The chat does not belong to the current organization. |
| 400 | resource.not.found | %s | The Bot does not exist. |
| 400 | unauthorized | %s | Unauthorized. |
| 400 | auth.error | %s | Insufficient permissions. The operation is not allowed. |
| 500 | system.error | Unknown system error | Unknown system error. |