Skip to content

更新推送

更新推送信息,只有在草稿状态下才可以调用此接口进行更新。

请求

项目
HTTP URLhttps://open.feishu.cn/open-apis/helpdesk/v1/notifications/:notification_id
HTTP MethodPATCH
接口频率限制20 次/分钟
支持的应用类型custom
权限要求 调用该 API 所需的权限。开启其中任意一项权限即可调用helpdesk:all 更新服务台资源详情
字段权限要求> Tip: 该接口返回体中存在下列敏感字段,仅当开启对应的权限后才会返回;如果无需获取这些字段,则不建议申请 contact:user.employee_id:readonly 获取用户 user ID

请求头

名称类型必填描述
Authorizationstringuser_access_token 值格式:"Bearer access_token" 示例值:"Bearer u-7f1bcd13fc57d46bac21793a18e560" 了解更多:如何选择与获取 access token
Content-Typestring固定值:"application/json; charset=utf-8"

Tip: 服务台请求Header中还需添加“服务台token”参数:

Key: X-Lark-Helpdesk-Authorization

Value: base64(helpdesk_id:helpdesk_token),通过base64加密将helpdesk_id和helpdesk_token用':'连接而成的字符串。

了解更多:获取与使用服务台token

路径参数

名称类型描述
notification_idstringpush任务唯一id
示例值:"6985032626234982420"

查询参数

名称类型必填描述
user_id_typestring用户 ID 类型
示例值:open_id
可选值有
- open_id: 标识一个用户在某个应用中的身份。同一个用户在不同应用中的 Open ID 不同。了解更多:如何获取 Open ID - union_id: 标识一个用户在某个应用开发商下的身份。同一用户在同一开发商下的应用中的 Union ID 是相同的,在不同开发商下的应用中的 Union ID 是不同的。通过 Union ID,应用开发商可以把同个用户在多个应用中的身份关联起来。了解更多:如何获取 Union ID? - user_id: 标识一个用户在某个租户内的身份。同一个用户在租户 A 和租户 B 内的 User ID 是不同的。在同一个租户内,一个用户的 User ID 在所有应用(包括商店应用)中都保持一致。User ID 主要用于在不同的应用间打通用户数据。了解更多:如何获取 User ID?
默认值open_id
当值为 user_id,字段权限要求contact:user.employee_id:readonly 获取用户 user ID

请求体

名称类型必填描述
idstring非必填,创建成功后返回
示例值:"6981801914270744596"
job_namestring必填,任务名称
示例值:"测试推送任务"
statusint非必填,创建成功后返回
示例值:0
create_usernotification_user非必填,创建人
示例值{"avatar_url":"","name":"","user_id":"ou_7277fd1262bfafc363d5b2a1f9c2ac90"}
  └ user_idstring非必填,用户id
示例值:"ou_7277fd1262bfafc363d5b2a1f9c2ac90"
  └ avatar_urlstring非必填,头像地址
示例值:"http://.com/.png"
  └ namestring非必填,用户名称
示例值:"test"
created_atstring非必填,创建时间(毫秒时间戳)
示例值:"1626332244719"
update_usernotification_user非必填,更新用户
示例值{"avatar_url":"","name":"","user_id":"ou_7277fd1262bfafc363d5b2a1f9c2ac90"}
  └ user_idstring非必填,用户id
示例值:"ou_7277fd1262bfafc363d5b2a1f9c2ac90"
  └ avatar_urlstring非必填,头像地址
示例值:"http://.com/.png"
  └ namestring非必填,用户名称
示例值:"test"
updated_atstring非必填,更新时间(毫秒时间戳)
示例值:"1626332244719"
target_user_countint非必填,目标推送用户总数
示例值:1
sent_user_countint非必填,已推送用户总数
示例值:1
read_user_countint非必填,已读用户总数
示例值:1
send_atstring非必填,推送任务触发时间(毫秒时间戳)
示例值:"1626332244719"
push_contentstring必填,推送内容,详见:https://open.feishu.cn/tool/cardbuilder?from=howtoguide
示例值:"{ \"config\": { \"wide_screen_mode\": true }, "elements": [ { \"tag\": \"div\", \"text\": { \"tag\": \"lark_md\", \"content\": \"[飞书](https://www.feishu.cn)整合即时沟通、日历、音视频会议、云文档、云盘、工作台等功能于一体,成就组织和个人,更高效、更愉悦。\" } } ] }"
push_typeint必填, 0(定时推送:push_scope不能等于3) 1(新人入职推送:push_scope必须等于1或者3;new_staff_scope_type不能为空)
示例值:0
push_scope_typeint必填, 推送范围(服务台私信) 0:组织内全部成员(user_list和department_list必须为空) 1:不推送任何成员(user_list和department_list必须为空,chat_list不可为空) 2:推送到部分成员(user_list或department_list不能为空) 3:入职新人 以上四种状态,chat_list都相对独立,只有在推送范围为1时,必须需要设置chat_list<br>示例值:0
new_staff_scope_typeint非必填, 新人入职范围类型(push_type为1时生效) 0:组织内所有新人 1:组织内特定的部门(new_staff_scope_department_list 字段不能为空)
示例值:0
new_staff_scope_department_listnotification_department\[\]非必填,新人入职生效部门列表
示例值:[{"department_id":"od_7c1a2815c9846b5e518b950de0e62de8"}]
  └ department_idstring部门ID
示例值:"od_7277fd1262bfafc363d5b2a1f9c2ac90"
  └ namestring非必填,部门名称
示例值:"测试部门"
user_listnotification_user\[\]非必填,push推送到成员列表
示例值:[{"user_id":"ou_7277fd1262bfafc363d5b2a1f9c2ac90"}]
  └ user_idstring非必填,用户id
示例值:"ou_7277fd1262bfafc363d5b2a1f9c2ac90"
  └ avatar_urlstring非必填,头像地址
示例值:"http://.com/.png"
  └ namestring非必填,用户名称
示例值:"test"
department_listnotification_department\[\]非必填,push推送到的部门信息列表
示例值:[{"department_id":"od_7c1a2815c9846b5e518b950de0e62de8"}]
  └ department_idstring部门ID
示例值:"od_7277fd1262bfafc363d5b2a1f9c2ac90"
  └ namestring非必填,部门名称
示例值:"测试部门"
chat_listnotification_chat\[\]非必填,push推送到的会话列表(群)
示例值:[{"chat_id":"oc_7c1a2815c9846b5e518b950de0e62de8"}]
  └ chat_idstring非必填,会话ID
示例值:"oc_7277fd1262bfafc363d5b2a1f9c2ac90"
  └ namestring非必填,会话名称
示例值:"测试群聊"
extstring非必填,预留扩展字段
示例值:"{}"

请求体示例

json
{
    "id": "6981801914270744596",
    "job_name": "测试推送任务",
    "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\": \"[飞书](https://www.feishu.cn)整合即时沟通、日历、音视频会议、云文档、云盘、工作台等功能于一体,成就组织和个人,更高效、更愉悦。\"       }     }   ] }",
    "push_type": 0,
    "push_scope_type": 0,
    "new_staff_scope_type": 0,
    "new_staff_scope_department_list": [
        {
            "department_id": "od_7277fd1262bfafc363d5b2a1f9c2ac90",
            "name": "测试部门"
        }
    ],
    "user_list": [
        {
            "user_id": "ou_7277fd1262bfafc363d5b2a1f9c2ac90",
            "avatar_url": "http://*.com/*.png",
            "name": "test"
        }
    ],
    "department_list": [
        {
            "department_id": "od_7277fd1262bfafc363d5b2a1f9c2ac90",
            "name": "测试部门"
        }
    ],
    "chat_list": [
        {
            "chat_id": "oc_7277fd1262bfafc363d5b2a1f9c2ac90",
            "name": "测试群聊"
        }
    ],
    "ext": "{}"
}

响应

响应体

名称类型描述
codeint错误码,非 0 表示失败
msgstring错误描述
data\--

响应体示例

json
{
    "code": 0,
    "msg": "success",
    "data": {}
}

错误码

HTTP状态码错误码描述排查建议
400154000Bad request, please check your request body请求不合法,请检查参数
401154001Unauthorized, please check you have the correct access检查Authorization 和 X-Lark-Helpdesk-Authorization 是否正确,应用和服务台属于同一租户
403154003Please check you have the correct access检查是否申请正确权限
404154004Resource not found资源不存在,请检查ID值
405154005Method Forbidden检查是否有权限创建推送
500155000Internal error内部错误,请联系我们

内容来源:飞书开放平台 · 自动爬取整理