dingtalk.oapi.message.corpconversation.sendbytemplate (工作通知模板化发送通知接口)

工作通知模板化发送通知接口

公共参数

请求参数

名称 类型 是否必须 示例值 更多限制 描述
agent_id Number 必须 123 微应用的id
userid_list String [] 可选 "123,456"
  • 最大列表长度:5000
  • 接收者的用户userid列表
    dept_id_list Number [] 可选 "123,456"
  • 最大列表长度:500
  • 接收者的部门id列表
    template_id String 必须 xxxx 消息模板id
    data Json 可选 {"名字":"张三"} 消息模板动态参数赋值数据, key和value均为字符串格式。

    响应参数

    名称 类型 示例值 描述
    errmsg String ok 错误信息
    errcode Number 0 返回码
    task_id Number 123 创建的异步发送任务id

    请求示例

    • JAVA
    • .NET
    • PHP
    • CURL
    • Python
    • C/C++
    • NodeJS
    DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/sendbytemplate");
    OapiMessageCorpconversationSendbytemplateRequest req = new OapiMessageCorpconversationSendbytemplateRequest();
    req.setAgentId(123L);
    req.setUseridList("\"123,456\"");
    req.setDeptIdList("\"123,456\"");
    req.setTemplateId("xxxx");
    req.setDataString("{\"名字\":\"张三\"}");
    OapiMessageCorpconversationSendbytemplateResponse rsp = client.execute(req, access_token);
    System.out.println(rsp.getBody());

    响应示例

    • JSON示例
    {
        "errmsg":"ok",
        "errcode":0,
        "task_id":123
    }

    异常示例

    • JSON示例
    {
    	"errcode":88,
    	"errmsg":"ding talk error"
    }

    错误码解释

    错误码 错误描述 解决方案

    API工具

    如何获得此API

    FAQ

    返回
    顶部