API call description
- This API is designed for OA work notifications and updates approval statuses in real time.
- This API can only update the status bar of work notifications sent within the past 7 days.
Request
| Basic information | |
|---|---|
| HTTP URL | https://api.dingtalk.io/topapi/message/corpconversation/status_bar/update |
| HTTP Method | POST |
| Supported app types | appType-Internal appappType-Third-party enterprise app |
| Required permissions | permission-qyapi_base-Basic permissions required to call enterprise APIs |
Query parameters
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| access_token | String | Yes | bE74xxxx | The app credential used to call this API. - For an internal app, obtain it by calling the API for getting the access_token of an internal app. - For a third-party enterprise app, obtain it by calling the API for getting the access_token of a third-party enterprise. |
Request body
| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| agent_id | Number | Yes | 123 | The AgentId of the micro app used to send the message. - For an internal app, view it on the app details page in the Developer Backend. - For a third-party enterprise app, obtain it by calling the API for getting enterprise authorization information. |
| task_id | Number | Yes | 11 | The ID of the work notification task. Obtain the task_id value by calling the Send work notifications API. |
| status_value | String | Yes | Accepted | The status bar value. |
| status_bg | String | No | 0xFF78C06E | The background color of the status bar. We recommend the format 0xFF followed by a six-digit color value. |
Request example
curl -X POST "https://api.dingtalk.io/topapi/message/corpconversation/status_bar/update" \
-H 'Content-Type:application/x-www-form-urlencoded;charset=utf-8' \
-d 'access_token=e4bbxxxxe7683' \
-d 'agent_id=123' \
-d 'status_bg=0xFFF65E5E' \
-d 'status_value=Completed' \
-d 'task_id=1111'
DingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/message/corpconversation/status_bar/update");
OapiMessageCorpconversationStatusBarUpdateRequest req = new OapiMessageCorpconversationStatusBarUpdateRequest();
req.setAgentId(123L);
req.setTaskId(1111L);
req.setStatusValue("Completed");
req.setStatusBg("0xFFF65E5E");
OapiMessageCorpconversationStatusBarUpdateResponse rsp = client.execute(req, access_token);
System.out.println(rsp.getBody());
import dingtalk.api
req=dingtalk.api.OapiMessageCorpconversationStatusBarUpdateRequest("https://api.dingtalk.io/topapi/message/corpconversation/status_bar/update")
req.agent_id=123
req.task_id=1111
req.status_value="Completed"
req.status_bg="0xFFF65E5E"
try:
resp= req.getResponse(access_token)
print(resp)
except Exception,e:
print(e)
include "TopSdk.php";
date_default_timezone_set('Asia/Shanghai');
$c = new DingTalkClient(DingTalkConstant::$CALL_TYPE_OAPI, DingTalkConstant::$METHOD_POST , DingTalkConstant::$FORMAT_JSON);
$req = new OapiMessageCorpconversationStatusBarUpdateRequest;
$req->setAgentId("123");
$req->setTaskId("1111");
$req->setStatusValue("Completed");
$req->setStatusBg("0xFFF65E5E");
$resp = $c->execute($req, $access_token, "https://api.dingtalk.io/topapi/message/corpconversation/status_bar/update");
IDingTalkClient client = new DefaultDingTalkClient("https://api.dingtalk.io/topapi/message/corpconversation/status_bar/update");
OapiMessageCorpconversationStatusBarUpdateRequest req = new OapiMessageCorpconversationStatusBarUpdateRequest();
req.AgentId = 123L;
req.TaskId = 1111L;
req.StatusValue = "Completed";
req.StatusBg = "0xFFF65E5E";
OapiMessageCorpconversationStatusBarUpdateResponse rsp = client.Execute(req, access_token);
Console.WriteLine(rsp.Body);
Response
Response body
| Name | Type | Example | Description |
|---|---|---|---|
| request_id | String | 4jzllmte0wau | The request ID. |
| errmsg | String | ok | The description of the return code. |
| errcode | Number | 0 | The return code. |
Response body example
{
"request_id":"4jzllmte0wau"
"errcode":0,
"errmsg":"ok",
}
Error codes
If an error occurs when you call this API, look up the error message in the Global error codes document to find a solution.| Error code (errorcode) | Error message (errmsg) | Solution |
|---|---|---|
| 40056 | Invalid agentid | Verify that the agentId is correct. |
| 40035 | Invalid parameter | Verify that the taskId is correct. |
| 41052 | Too many recipients in this delivery; sending results will no longer be returned. | - Reduce the number of recipients for the work notification. - Check whether the work notification has finished sending. This error occurs if sending is still in progress. |
| 500 | System error | An unknown system error occurred. |