Skip to main content
Call this API to update the status of an OA work notification message.

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 URLhttps://oapi.dingtalk.io/topapi/message/corpconversation/status_bar/update
HTTP MethodPOST
Supported app typesappType-Internal appappType-Third-party enterprise app
Required permissionspermission-qyapi_base-Basic permissions required to call enterprise APIs

Query parameters

NameTypeRequiredExampleDescription
access_tokenStringYesbE74xxxxThe 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

NameTypeRequiredExampleDescription
agent_idNumberYes123The 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_idNumberYes11The ID of the work notification task. Obtain the task_id value by calling the Send work notifications API.
status_valueStringYesAcceptedThe status bar value.
status_bgStringNo0xFF78C06EThe background color of the status bar. We recommend the format 0xFF followed by a six-digit color value.

Request example

curl -X POST "https://oapi.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'
Java
DingTalkClient client = new DefaultDingTalkClient("https://oapi.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());
Python
import dingtalk.api

req=dingtalk.api.OapiMessageCorpconversationStatusBarUpdateRequest("https://oapi.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)
PHP
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://oapi.dingtalk.io/topapi/message/corpconversation/status_bar/update");
C#
IDingTalkClient client = new DefaultDingTalkClient("https://oapi.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

NameTypeExampleDescription
request_idString4jzllmte0wauThe request ID.
errmsgStringokThe description of the return code.
errcodeNumber0The 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
40056Invalid agentidVerify that the agentId is correct.
40035Invalid parameterVerify that the taskId is correct.
41052Too 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.
500System errorAn unknown system error occurred.