dingtalk.oapi.message.corpconversation.asyncsend (企业会话消息异步发送)

企业会话消息异步发送接口

公共参数

请求参数

名称 类型 是否必须 示例值 更多限制 描述
msgtype String 必须 oa 消息类型,如text、file、oa等,具体见文档
agent_id Number 必须 1234 微应用的id
userid_list String [] 可选 zhangsan,lisi
  • 最大列表长度:100
  • 接收者的用户userid列表
    dept_id_list Number [] 可选 123,456
  • 最大列表长度:20
  • 接收者的部门id列表
    to_all_user Boolean 可选 false
  • 默认值:false
  • 是否发送给企业全部用户
    msgcontent Json 必须 {"content":"消息内容"} 与msgtype对应的消息体,具体见文档

    响应参数

    名称 类型 示例值 描述
    errcode Number 0 errcode
    errmsg String ok errmsg
    task_id Number 123 创建的异步发送任务id

    请求示例

    • JAVA
    • .NET
    • PHP
    • CURL
    • Python
    • C/C++
    • NodeJS
    DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend");
    OapiMessageCorpconversationAsyncsendRequest req = new OapiMessageCorpconversationAsyncsendRequest();
    req.setMsgtype("oa");
    req.setAgentId(1234L);
    req.setUseridList("zhangsan,lisi");
    req.setDeptIdList("123,456");
    req.setToAllUser(false);
    req.setMsgcontentString("{\"content\":\"消息内容\"}");
    OapiMessageCorpconversationAsyncsendResponse rsp = client.execute(req, access_token);
    System.out.println(rsp.getBody());

    响应示例

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

    异常示例

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

    错误码解释

    错误码 错误描述 解决方案

    API工具

    如何获得此API

    FAQ

    返回
    顶部