批量发送消息
机器人批量发送消息
Section titled “机器人批量发送消息”https://chat-go.jwzhd.com/open-apis/v1/bot/batch_send?token=xxxxxxxxxx
curl --location --request POST 'https://chat-go.jwzhd.com/open-apis/v1/bot/batch_send?token=xxxx' \--header 'Content-Type: application/json' \--data-raw '{ "recvIds": ["7058262", "7058263"], "recvType": "user", "contentType": "text", "content": { "text": "这里是消息内容" }}'Content-Type: "application/json; charset=utf-8"| 字段 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| recvIds | list | 是 | 接收消息对象ID 用户: userIds 群: groupIds |
| recvType | string | 是 | 接收对象类型 用户: user 群: group |
| contentType | string | 是 | 消息类型,取值如下 text\image\file\markdown\html |
| content | Content对象 | 是 | 消息对象 |
Content对象
Section titled “Content对象”contentType为text
| 字段 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| text | string | 是 | 消息正文 |
| buttons | Button对象列表 | 否 | 消息中包括button |
contentType为image
| 字段 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| imageKey | string | 是 | 图片Key, 通过图片上传接口获得 |
| buttons | Button对象列表 | 否 | 消息中包括button |
contentType为markdown
| 字段 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| text | string | 是 | markdown字符串 |
| buttons | Button对象列表 | 否 | 消息中包括button |
contentType为file
| 字段 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| fileName | string | 是 | 文件名 |
| fileUrl | string | 是 | 文件URL |
| buttons | Button对象列表 | 否 | 消息中包括button |
Button对象
Section titled “Button对象”| 字段 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| text | string | 是 | 按钮上的文字 |
| actionType | int | 是 | 1: 跳转URL 2: 复制 3: 点击汇报 |
| url | string | 否 | 当actionType为1时使用 |
| value | string | 否 | 当actionType为2时,该值会复制到剪贴板 当actionType为3时,该值会发送给订阅端 |
| 字段 | 类型 | 说明 |
|---|---|---|
| code | int | 响应代码 |
| msg | string | 响应信息,包括异常信息 |
| data | Object | 返回数据 |
批量发送文本消息请求示例
Section titled “批量发送文本消息请求示例”{ "recvIds": ["7058262", "7058263"], "recvType": "user", "contentType": "text", "content": { "text": "这里是消息内容", "buttons": [ [ { "text": "复制", "actionType": 2, "value": "xxxx" }, { "text": "点击跳转", "actionType": 1, "url": "http://www.baidu.com" } ] ] }}