# Update notification

Update push message. This API can only be called when the message is in draft status.

## Request

Facts | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/helpdesk/v1/notifications/:notification_id
HTTP Method | PATCH
Rate Limit | [20 per minute](https://open.feishu.cn/document/ukTMukTMukTM/uUzN04SN3QjL1cDN)
Supported app types | Custom App
Required scopes<br>**To use this API, you must have at least 1 of the listed scopes.** | Update resources details of Help Desk(helpdesk:all)
Required field scopes | **Notice**：The response body of the API contains the following sensitive fields, and they will be returned only after corresponding scopes are added. If you do not need the fields, it is not recommended that you request the scopes.<br>Obtain user ID(contact:user.employee_id:readonly)

### Request header

Parameter | Type | Required | Description
---|---|---|---
Authorization | string | Yes | `user_access_token`<br>**Value format**: "Bearer `access_token`"<br>**Example value**: "Bearer u-7f1bcd13fc57d46bac21793a18e560"<br>[How to choose and get access token](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-choose-which-type-of-token-to-use)
Content-Type | string | Yes | **Fixed value**: "application/json; charset=utf-8"

### Path parameters

Parameter | Type | Description
---|---|---
notification_id | string | Push task unique ID<br>**Example value**: "6985032626234982420"

### Query parameters

Parameter | Type | Required | Description
---|---|---|---
user_id_type | string | No | User ID categories<br>**Example value**: open_id<br>**Optional values are**:<br>- open_id：Identifies a user to an app. The same user has different Open IDs in different apps. [How to get Open ID](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-obtain-openid)<br>- union_id：Identifies a user to a tenant that acts as a developer. A user has the same Union ID in apps developed by the same developer, and has different Union IDs in apps developed by different developers. A developer can use Union ID to link the same user's identities in multiple apps.[How to get Union ID](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-obtain-union-id)<br>- user_id：Identifies a user to a tenant. The same user has different User IDs in different tenants. In one single tenant, a user has the same User ID in all apps （including store apps）. User ID is usually used to communicate user data between different apps. [How to get User ID](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-obtain-user-id)<br>**Default value**: `open_id`<br>**When the value is `user_id`, the following field scopes are required**:<br>Obtain user ID(contact:user.employee_id:readonly)

### Request body

Parameter | Type | Required | Description
---|---|---|---
id | string | No | Optional, returned upon successful creation<br>**Example value**: "6981801914270744596"
job_name | string | No | Required, task name<br>**Example value**: "Test the push task"
status | int | No | Optional, returned upon successful creation<br>**Example value**: 0
create_user | notification_user | No | Optional, creator<br>**Example value**: {"avatar_url":"","name":"","user_id":"ou_7277fd1262bfafc363d5b2a1f9c2ac90"}
user_id | string | No | Optional, user ID<br>**Example value**: "ou_7277fd1262bfafc363d5b2a1f9c2ac90"
avatar_url | string | No | Optional, profile photo address<br>**Example value**: "http://*.com/*.png"
name | string | No | Optional, user name<br>**Example value**: "test"
created_at | string | No | Optional, creation time (timestamp in ms)<br>**Example value**: "1626332244719"
update_user | notification_user | No | Optional, updated by<br>**Example value**: {"avatar_url":"","name":"","user_id":"ou_7277fd1262bfafc363d5b2a1f9c2ac90"}
user_id | string | No | Optional, user ID<br>**Example value**: "ou_7277fd1262bfafc363d5b2a1f9c2ac90"
avatar_url | string | No | Optional, profile photo address<br>**Example value**: "http://*.com/*.png"
name | string | No | Optional, user name<br>**Example value**: "test"
updated_at | string | No | Optional, last update (timestamp in ms)<br>**Example value**: "1626332244719"
target_user_count | int | No | Optional, total number of target users pushed<br>**Example value**: 1
sent_user_count | int | No | Optional, total number of users pushed<br>**Example value**: 1
read_user_count | int | No | Optional, total number of users who have read<br>**Example value**: 1
send_at | string | No | Optional, push task trigger time (timestamp in ms)<br>**Example value**: "1626332244719"
push_content | string | No | Required, push content. For details, visit https://open.feishu.cn/tool/cardbuilder?from<br>helpdesk.v1.type.notification.prop.read_user_count.desc=$$$Optional, total number of users who have read<br>**Example value**: "{   \"config\": {     \"wide_screen_mode\": true   },   \"elements\": [     {       \"tag\": \"div\",       \"text\": {         \"tag\": \"lark_md\",         \"content\": \"[Feishu](https://www.feishu.cn) Integrate instant communication, Calendar, audio and video conferencing, Docs, Drive, and Workplace to make organizations and individuals to work more efficiently and happily.\"       }     }   ] }"
push_type | int | No | Required,<br>0 (Timed push: push_scope cannot be equal to 3), 1 (New staff onboarding push: push_scope must be equal to 1 or 3; new_staff_scope_type cannot be empty)<br>**Example value**: 0
push_scope_type | int | No | Required,<br>push scope (Help Desk private message) 0: All members in the organization (user_list and department_list must be empty), 1: None of the members (user_list and department_list must be empty, and chat_list cannot be empty), 2: Specified members (user_list or department_list cannot be empty), 3: New staff. chat_list for these four scopes are relatively independent, and is only required when the push scope is 1. <br>**Example value**: 0
new_staff_scope_type | int | No | Optional,<br>new staff enrollment scope type (effective when push_type is 1) 0: All new staff in the organization, 1: Specific department in the organization (new_staff_scope_department_list field cannot be empty)<br>**Example value**: 0
new_staff_scope_department_list | notification_department\[\] | No | Optional, list of effective departments with onboarded employees<br>**Example value**: [{"department_id":"od_7c1a2815c9846b5e518b950de0e62de8"}]
department_id | string | No | Department ID<br>**Example value**: "od_7277fd1262bfafc363d5b2a1f9c2ac90"
name | string | No | Optional, department name<br>**Example value**: "Test department"
user_list | notification_user\[\] | No | Optional, list of members to whom the message is pushed<br>**Example value**: [{"user_id":"ou_7277fd1262bfafc363d5b2a1f9c2ac90"}]
user_id | string | No | Optional, user ID<br>**Example value**: "ou_7277fd1262bfafc363d5b2a1f9c2ac90"
avatar_url | string | No | Optional, profile photo address<br>**Example value**: "http://*.com/*.png"
name | string | No | Optional, user name<br>**Example value**: "test"
department_list | notification_department\[\] | No | Optional, list of departments to which the message is pushed<br>**Example value**: [{"department_id":"od_7c1a2815c9846b5e518b950de0e62de8"}]
department_id | string | No | Department ID<br>**Example value**: "od_7277fd1262bfafc363d5b2a1f9c2ac90"
name | string | No | Optional, department name<br>**Example value**: "Test department"
chat_list | notification_chat\[\] | No | Optional, list of group chats to which the message is pushed<br>**Example value**: [{"chat_id":"oc_7c1a2815c9846b5e518b950de0e62de8"}]
chat_id | string | No | Optional, chat ID<br>**Example value**: "oc_7277fd1262bfafc363d5b2a1f9c2ac90"
name | string | No | Optional, chat name<br>**Example value**: "Test group chat"
ext | string | No | Optional, extended field reserved<br>**Example value**: "{}"

### Request body example
```json
{
    "id": "6981801914270744596",
    "job_name": "Test the push task",
    "status": 0,
    "create_user": {
        "user_id": "ou_7277fd1262bfafc363d5b2a1f9c2ac90",
        "avatar_url": "http://*.com/*.png",
        "name": "test"
    },
    "created_at": "1626332244719",
    "update_user": {
        "user_id": "ou_7277fd1262bfafc363d5b2a1f9c2ac90",
        "avatar_url": "http://*.com/*.png",
        "name": "test"
    },
    "updated_at": "1626332244719",
    "target_user_count": 1,
    "sent_user_count": 1,
    "read_user_count": 1,
    "send_at": "1626332244719",
    "push_content": "{   \"config\": {     \"wide_screen_mode\": true   },   \"elements\": [     {       \"tag\": \"div\",       \"text\": {         \"tag\": \"lark_md\",         \"content\": \"[Feishu](https://www.feishu.cn) Integrate instant communication, Calendar, audio and video conferencing, Docs, Drive, and Workplace to make organizations and individuals to work more efficiently and happily.\"       }     }   ] }",
    "push_type": 0,
    "push_scope_type": 0,
    "new_staff_scope_type": 0,
    "new_staff_scope_department_list": [
        {
            "department_id": "od_7277fd1262bfafc363d5b2a1f9c2ac90",
            "name": "Test department"
        }
    ],
    "user_list": [
        {
            "user_id": "ou_7277fd1262bfafc363d5b2a1f9c2ac90",
            "avatar_url": "http://*.com/*.png",
            "name": "test"
        }
    ],
    "department_list": [
        {
            "department_id": "od_7277fd1262bfafc363d5b2a1f9c2ac90",
            "name": "Test department"
        }
    ],
    "chat_list": [
        {
            "chat_id": "oc_7277fd1262bfafc363d5b2a1f9c2ac90",
            "name": "Test group chat"
        }
    ],
    "ext": "{}"
}
```

## Response

### Response body

Parameter | Type | Description
---|---|---
code | int | Error codes, fail if not zero
msg | string | Error descriptions
data | \- | \-

### Response body example
```json
{
    "code": 0,
    "msg": "success",
    "data": {}
}
```

### Error code

HTTP status code | Error code | Description | Troubleshooting suggestions
---|---|---|---
400 | 154000 | Bad request, please check your request body | Invalid request. Check the parameters.
401 | 154001 | Unauthorized, please check you have the correct access | Check if Authorization and X-Lark-Helpdesk-Authorization are correct and the app and Help Desk belong to the same tenant.
403 | 154003 | Please check you have the correct access | Check if the correct permission scope is requested.
404 | 154004 | Resource not found | Check the ID value.
405 | 154005 | Method Forbidden | Check for permission scope to create push.
500 | 155000 | Internal error | Internal error, please contact us

