dingtalk.oapi.message.send_to_single_conversation (企业内个人之间发送单聊消息接口)

企业内个人之间发送单聊消息接口

公共参数

请求参数

名称 类型 是否必须 示例值 更多限制 描述
sender_userid String 必须 123 发送者userId
receiver_userid String 必须 456 接收者userId
msg Msg 必须 推送消息内容
  • └ msgtype
  • String
  • 必须
  • markdown
  • 消息内容类型,目前只支持markdown
  • markdown
  • Markdown
  • 必须
  • markdown消息内容
  • └ text
  • String
  • 必须
  • 测试消息[钉钉官网](https://dingtalk.com)
  • markdown消息内容

响应参数

名称 类型 示例值 描述
msg_id String msgId123 推送消息标识
errcode Number 0 错误码 0 表示成功
errmsg String ok 错误描述

请求示例

  • JAVA
  • .NET
  • PHP
  • CURL
  • Python
  • C/C++
  • NodeJS
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/send_to_single_conversation");
OapiMessageSendToSingleConversationRequest req = new OapiMessageSendToSingleConversationRequest();
req.setSenderUserid("123");
req.setReceiverUserid("456");
Msg obj1 = new Msg();
obj1.setMsgtype("markdown");
Markdown obj2 = new Markdown();
obj2.setText("测试消息[钉钉官网](https://dingtalk.com)");
obj1.setMarkdown(obj2);
req.setMsg(obj1);
OapiMessageSendToSingleConversationResponse rsp = client.execute(req, access_token);
System.out.println(rsp.getBody());

响应示例

  • JSON示例
{
    "msg_id":"msgId123",
    "errcode":0,
    "errmsg":"ok"
}

异常示例

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

错误码解释

错误码 错误描述 解决方案

API工具

如何获得此API

FAQ

返回
顶部