首页 > API中心 > IVR群呼 > 文档指引
| 参数 | 说明 | 是否必填 | 类型 |
|---|---|---|---|
| appId | 应用Id | 是 | String |
| businessPhone | 商家号码 | 是 | String |
| channelType | 通道类型:0-WhatsApp,默认送0; | 是 | Integer |
| recipient | 接收号码 | 是 | String |
| type | 消息类型:text、image、audio、video、location、document、sticker、interactive、contacts; 文件大小限制( text:4096字符、audio:16MB、document:100MB、image:5MB、video:16MB、sticker: 100KB); 具体类型传参数请看下面文档说明: |
是 | String |
| 参数 | 说明 | 是否必填 | 类型 |
|---|---|---|---|
| text | 发送文本消息时必填 | 否 | Object |
| body | 正文,发送文本消息时必填 | 否 | String |
Request URL:
https://api.itniotech.com/wa/custom/sendMsg
Request Method:
POST
Request Headers:
Content-Type: application/json;charset=UTF-8
Sign: 05d7a50893e22a5c4bb3216ae3396c7c
Timestamp: 1630468800
Api-Key: bDqJFiq9
Request Body:
{
"appId": "DGziZf5u",
"businessPhone": "91856321321",
"recipient": "91856321322",
"channelType": 0,
"type": "text",
"text": {
"body": "this is body content"
}
}| 参数 | 说明 | 是否必填 | 类型 |
|---|---|---|---|
| context | 上下文对象 | 否 | Object |
| refMessageId | 回复上行消息id | 否 | String |
Request URL:
https://api.itniotech.com/wa/custom/sendMsg
Request Method:
POST
Request Headers:
Content-Type: application/json;charset=UTF-8
Sign: 05d7a50893e22a5c4bb3216ae3396c7c
Timestamp: 1630468800
Api-Key: bDqJFiq9
Request Body:
{
"appId": "DGziZf5u",
"businessPhone": "17376111187",
"recipient": "8618099900000",
"channelType": 0,
"type": "text",
"text": {
"body": "this is body content"
},
"context": { //上下文
"refMessageId": "1" //消息id
}
}| 参数 | 说明 | 是否必填 | 类型 |
|---|---|---|---|
| image | 发送图片消息时必填 | 否 | Object |
| link | 图片链接,发送图片消息时必填 | 否 | String |
| caption | 标题 | 否 | String |
Request URL:
https://api.itniotech.com/wa/custom/sendMsg
Request Method:
POST
Request Headers:
Content-Type: application/json;charset=UTF-8
Sign: 05d7a50893e22a5c4bb3216ae3396c7c
Timestamp: 1630468800
Api-Key: bDqJFiq9
Request Body:
{
"appId": "DGziZf5u",
"businessPhone": "91856321321",
"recipient": "91856321322",
"channelType": 0,
"type": "image",
"image": {
"link": "https://abc.com/log.png",
"caption": "title"
}
}| 参数 | 说明 | 是否必填 | 类型 |
|---|---|---|---|
| document | 发送文档消息时必填 | 否 | Object |
| link | 文档链接,发送文档消息时必填 | 否 | String |
| filename | 文档名称,发送文档消息时必填 | 否 | String |
| caption | 标题 | 否 | String |
Request URL:
https://api.itniotech.com/wa/custom/sendMsg
Request Method:
POST
Request Headers:
Content-Type: application/json;charset=UTF-8
Sign: 05d7a50893e22a5c4bb3216ae3396c7c
Timestamp: 1630468800
Api-Key: bDqJFiq9
Request Body:
{
"appId": "DGziZf5u",
"businessPhone": "91856321321",
"recipient": "91856321322",
"channelType": 0,
"type": "document",
"document": {
"link": "https://abc.com/log.png",
"filename": "123",
"caption": "title"
}
}| 参数 | 说明 | 是否必填 | 类型 |
|---|---|---|---|
| audio | 发送音频消息时必填 | 否 | Object |
| link | 语音链接,发送音频消息时必填 | 否 | String |
Request URL:
https://api.itniotech.com/wa/custom/sendMsg
Request Method:
POST
Request Headers:
Content-Type: application/json;charset=UTF-8
Sign: 05d7a50893e22a5c4bb3216ae3396c7c
Timestamp: 1630468800
Api-Key: bDqJFiq9
Request Body:
{
"appId": "DGziZf5u",
"businessPhone": "91856321321",
"recipient": "91856321322",
"channelType": 0,
"type": "audio",
"audio": {
"link": "https://abc.com/log.png"
}
}| 参数 | 说明 | 是否必填 | 类型 |
|---|---|---|---|
| video | 发送视频消息时必填 | 否 | Object |
| link | 视频链接,发送视频消息时必填 | 否 | String |
| caption | 标题 | 否 | String |
Request URL:
https://api.itniotech.com/wa/custom/sendMsg
Request Method:
POST
Request Headers:
Content-Type: application/json;charset=UTF-8
Sign: 05d7a50893e22a5c4bb3216ae3396c7c
Timestamp: 1630468800
Api-Key: bDqJFiq9
Request Body:
{
"appId": "DGziZf5u",
"businessPhone": "91856321321",
"recipient": "91856321322",
"channelType": 0,
"type": "video",
"video": {
"link": "https://abc.com/log.png",
"caption": "title"
}
}| 参数 | 说明 | 是否必填 | 类型 |
|---|---|---|---|
| sticker | 发送贴图消息时必填 | 否 | Object |
| link | 贴图链接,发送贴图消息时必填 | 否 | String |
Request URL:
https://api.itniotech.com/wa/custom/sendMsg
Request Method:
POST
Request Headers:
Content-Type: application/json;charset=UTF-8
Sign: 05d7a50893e22a5c4bb3216ae3396c7c
Timestamp: 1630468800
Api-Key: bDqJFiq9
Request Body:
{
"appId": "DGziZf5u",
"businessPhone": "91856321321",
"recipient": "91856321322",
"channelType": 0,
"type": "sticker",
"sticker":{
"link":"https://abc.com/log.webp"
}
}| 参数 | 说明 | 是否必填 | 类型 |
|---|---|---|---|
| location | 发送位置消息时必填 | 否 | Object |
| longitude | 经度,发送位置消息时必填 | 否 | String |
| latitude | 纬度,发送位置消息时必填 | 否 | String |
| name | 位置名称,发送位置消息时必填 | 否 | String |
| address | 地址描述,发送位置消息时必填 | 否 | String |
Request URL:
https://api.itniotech.com/wa/custom/sendMsg
Request Method:
POST
Request Headers:
Content-Type: application/json;charset=UTF-8
Sign: 05d7a50893e22a5c4bb3216ae3396c7c
Timestamp: 1630468800
Api-Key: bDqJFiq9
Request Body:
{
"appId": "DGziZf5u",
"businessPhone": "91856321321",
"recipient": "91856321322",
"channelType": 0,
"location": {
"address": "深圳市龙岗区",
"latitude": "62.636152267456",
"link": "https://123",
"name": "深圳",
"longitude": "104.056640625"
}
}| 参数 | 说明 | 是否必填 | 类型 |
|---|---|---|---|
| interactive | 交互式消息 | Object | |
| type | 交互式消息类型,list | 是 | String |
| header | 列表消息的页眉 | 否 | |
| type | 页眉的类型,interactive | 是 | String |
| text | 内容 | 否 | String |
| body | 列表消息的正文 | 是 | |
| text | 正文内容 | 是 | String |
| footer | 列表消息的页脚 | 否 | |
| text | 页脚的内容 | 否 | String |
| action | |||
| button | 用户在阅读消息后执行的操作 | 是 | String |
| sections | 节数组。最少1个,最多10个。 | 是 | Array |
| title | 节数组的标题,24个字符。 | 是 | String |
| rows | 行数组。您总共可以有10行。 | 是 | Array |
| id | 行的编号,200个字符 | 是 | String |
| title | 行的标题,24个字符 | 是 | String |
| description | 行的描述,72个字符 | 否 | String |
Request URL:
https://api.itniotech.com/wa/custom/sendMsg
Request Method:
POST
Request Headers:
Content-Type: application/json;charset=UTF-8
Sign: 05d7a50893e22a5c4bb3216ae3396c7c
Timestamp: 1630468800
Api-Key: bDqJFiq9
Request Body:
{
"appId": "7WY0BQ7W",
"businessPhone": 6282299953162,
"channelType": 0,
"recipient": "8614718004557",
"type": "interactive",
"interactive": {
"type": "list",
"header": {
"type": "text",
"text": "HEADER_TEXT"
},
"body": {
"text": "BODY_TEXT"
},
"footer": {
"text": "FOOTER_TEXT"
},
"action": {
"button": "BUTTON_TEXT",
"sections": [
{
"title": "SECTION_1_TITLE",
"rows": [
{
"id": "SECTION_1_ROW_1_ID",
"title": "SECTION_1_ROW_1_TITLE",
"description": "SECTION_1_ROW_1_DESCRIPTION"
},
{
"id": "SECTION_1_ROW_2_ID",
"title": "SECTION_1_ROW_2_TITLE",
"description": "SECTION_1_ROW_2_DESCRIPTION"
}
]
},
{
"title": "SECTION_2_TITLE",
"rows": [
{
"id": "SECTION_2_ROW_1_ID",
"title": "SECTION_2_ROW_1_TITLE",
"description": "SECTION_2_ROW_1_DESCRIPTION"
},
{
"id": "SECTION_2_ROW_2_ID",
"title": "SECTION_2_ROW_2_TITLE",
"description": "SECTION_2_ROW_2_DESCRIPTION"
}
]
}
]
}
}
}
| 参数 | 说明 | 是否必填 | 类型 |
|---|---|---|---|
| interactive | 交互式消息 | Object | |
| type | 交互式消息类型,button | 是 | String |
| header | 列表消息的页眉 | 否 | |
| type | 页眉的类型,interactive | 是 | String |
| text | 内容 | 否 | String |
| body | 列表消息的正文 | 是 | |
| text | 正文内容 | 是 | String |
| footer | 列表消息的页脚 | 否 | |
| text | 页脚的内容 | 否 | String |
| action | |||
| buttons | 是 | ||
| type | 回复按钮支持的类型:reply。最多支持三个按钮 | 是 | String |
| reply | 是 | Object | |
| id | 按钮的唯一标识符。当用户单击按钮时,将在 Webhook 中返回此ID。最大长度:256个字符 | 是 | String |
| title | 按钮标题。它不能是空字符串,并且在消息中必须是唯一的(需测试)。20个字符 | 是 | String |
Request URL:
https://api.itniotech.com/wa/custom/sendMsg
Request Method:
POST
Request Headers:
Content-Type: application/json;charset=UTF-8
Sign: 05d7a50893e22a5c4bb3216ae3396c7c
Timestamp: 1630468800
Api-Key: bDqJFiq9
Request Body:
{
"appId": "7WY0BQ7W",
"businessPhone": 6282299953162,
"channelType": 0,
"recipient": "8614718004557",
"type": "interactive",
"interactive": {
"type": "button",
"body": {
"text": "BUTTON_TEXT"
},
"action": {
"buttons": [
{
"type": "reply",
"reply": {
"id": "22",
"title": "one"
}
},
{
"type": "reply",
"reply": {
"id": "33",
"title": "two"
}
}]
}
}
}| 参数 | 说明 | 是否必填 | 类型 |
|---|---|---|---|
| interactive | 交互式消息 | Object | |
| type | location_request_message | 是 | String |
| body | 正文 | 是 | |
| text | 正文内容 | 是 | String |
| action | |||
| name | send_location(固定值) | 是 |
Request URL:
https://api.itniotech.com/wa/custom/sendMsg
Request Method:
POST
Request Headers:
Content-Type: application/json;charset=UTF-8
Sign: 05d7a50893e22a5c4bb3216ae3396c7c
Timestamp: 1630468800
Api-Key: bDqJFiq9
Request Body:
{
"appId": "zRTc00Vs",
"businessPhone": 6282292229952762,
"channelType": 0,
"recipient": "86173333376738687",
"type": "interactive",
"interactive": { // the text object
"type": "location_request_message",
"body":{
"text":"广东省深圳市龙岗区"
},
"action":{
"name":"send_location"
}
}
}| 参数 | 说明 | 是否必填 | 类型 |
|---|---|---|---|
| contacts | 联系人消息 | Object | |
| birthday | 生日,YYYY-MM-DD格式 | 否 | String |
| addresses | 地址对象 | 否 | Array |
| street | 街道名称 | 否 | String |
| city | 城市名称 | 否 | String |
| state | 州 | 否 | String |
| zip | 邮政编码 | 否 | String |
| country | 完整的国家名称 | 否 | String |
| country_code | 国家缩写 | 否 | String |
| type | 地址类型:HOME(家庭)、WORK(工作) | 否 | String |
| emails | 地址对象 | 否 | Array |
| 电子邮件地址 | 否 | String | |
| type | 类型:HOME(家庭)、WORK(工作) | 否 | String |
| name | 是 | Object | |
| formatted_name | 全名 | 是 | String |
| first_name | 名字 | 否 | String |
| last_name | 姓氏 | 否 | String |
| middle_name | 中间名 | 否 | String |
| suffix | 名称后缀 | 否 | String |
| prefix | 名称前缀 | 否 | String |
| org | 否 | Object | |
| company | 公司名称 | 否 | String |
| department | 部门名称 | 否 | String |
| title | 职务 | 否 | String |
| phones | 否 | Array | |
| phone | 手机号 | 否 | String |
| type | 类型:CELL、MAIN、IPHONE、HOME、WORK | 否 | String |
| urls | 否 | Array | |
| url | 网址 | 否 | String |
| type | 类型:HOME、WORK | 否 | String |
Request URL:
https://api.itniotech.com/wa/custom/sendMsg
Request Method:
POST
Request Headers:
Content-Type: application/json;charset=UTF-8
Sign: 05d7a50893e22a5c4bb3216ae3396c7c
Timestamp: 1630468800
Api-Key: bDqJFiq9
Request Body:
{
"appId": "7WY0BQ7W",
"businessPhone": 6282299953162,
"channelType": 0,
"recipient": "8614718004557",
"type": "contacts",
"contacts": [
{
"addresses": [
{
"street": "STREET",
"city": "CITY",
"state": "STATE",
"zip": "ZIP",
"country": "COUNTRY",
"country_code": "COUNTRY_CODE",
"type": "HOME"
},
{
"street": "STREET",
"city": "CITY",
"state": "STATE",
"zip": "ZIP",
"country": "COUNTRY",
"country_code": "COUNTRY_CODE",
"type": "WORK"
}
],
"birthday": "1995-01-11",
"emails": [
{
"email": "EMAIL",
"type": "WORK"
},
{
"email": "EMAIL",
"type": "HOME"
}
],
"name": {
"formatted_name": "NAME",
"first_name": "FIRST_NAME",
"last_name": "LAST_NAME",
"middle_name": "MIDDLE_NAME",
"suffix": "SUFFIX",
"prefix": "PREFIX"
},
"org": {
"company": "COMPANY",
"department": "DEPARTMENT",
"title": "TITLE"
},
"phones": [
{
"phone": "PHONE_NUMBER",
"type": "HOME"
},
{
"phone": "PHONE_NUMBER",
"type": "WORK",
"wa_id": "PHONE_OR_WA_ID"
}
],
"urls": [
{
"url": "URL",
"type": "WORK"
},
{
"url": "URL",
"type": "HOME"
}
]
}
]
}| 参数 | 说明 | 是否必填 | 类型 |
|---|---|---|---|
| appId | 应用id | 是 | String |
| businessPhone | 商家号码 | 是 | String |
| channelType | 通道类型:0-WhatsApp | 是 | Integer |
| recipient | 接收号码 | 是 | String |
| type | 消息类型,interactive(交互式消息) | 是 | String |
| interactive | 交互式消息对象 | 必填,内部不支持 header、footer组件 | Object |
| type | 交互式消息类型,carousel(素材轮播消息) | 是 | String |
| body | 列表消息的正文 | 是 | Object |
| text | 正文的文本内容 | 必填,最大1024字符 | String |
| action | 用户在阅读消息后执行的操作。 | 是 | Object |
| cards | 卡片对象,限制2-10张 | 是 | array[object] |
| card_index | 图卡在图卡轮播中应显示的顺序,索引以 0 开始。0 表示第一张图卡,1 表示第二张图卡,以此类推。 | 必填,限制0-9 | Integer |
| type | 固定传:cta_url | 是 | String |
| header | 轮播卡片的页眉 | 否 | Object |
| type | 页眉的类型,image(图片)、video(视频) | 是 | String |
| image | 图片媒体对象 | 当变量类型type=image时必填 | Object |
| link | 素材链接 | 当变量类型type=image时必填 | String |
| video | 影音媒体对象 | 当变量类型type=video时必填 | Object |
| link | 素材链接 | 当变量类型type=video时必填 | String |
| body | 轮播卡片正文 | 否 | Object |
| text | 正文文本,不超过160个字符 | 是 | String |
| action | 用户在阅读消息后执行的操作 | 必填,只能包含1个网址跳转按钮或者1-2个快速回复按钮 | Object |
| 网址跳转按钮参数对象 | |||
| name | cta_url | 有访问网站按钮时必填 | String |
| parameters | 变量数组 | 有访问网站按钮时必填 | Array |
| display_text | 访问网站按钮文本,最多 20 个字符 | 有访问网站按钮时必填 | String |
| url | 用户轻触该按钮时要在设备的默认网页浏览器中加载的网址。 | 有访问网站按钮时必填,http(s)格式网址 | String |
| 快速回复按钮参数对象 | |||
| buttons | 快速回复按钮列表,限制1-2个 | 有快速回复按钮必填 | Array |
| type | 回复按钮支持的类型:quick_reply | 有快速回复按钮必填 | String |
| quick_reply | 快速回复按钮对象 | 有快速回复按钮必填 | Object |
| id | 按钮的唯一标识符。当用户单击按钮时,将在 Webhook 中返回此ID。最大长度:20个字符 | 有快速回复按钮必填 | String |
| title | 按钮标题。在消息中必须是唯一的。20个字符 | 有快速回复按钮必填 | String |
Request URL:
https://api.itniotech.com/wa/custom/sendMsg
Request Method:
POST
Request Headers:
Content-Type: application/json;charset=UTF-8
Sign: 05d7a50893e22a5c4bb3216ae3396c7c
Timestamp: 1630468800
Api-Key: bDqJFiq9
Request Body:
网址按钮消息:
{
"appId": "lYOxMDYC",
"channelType": 0,
"recipient": "8615986688129",
"businessPhone": "12026693133",
"type": "interactive",
"interactive": {
"type": "carousel",
"body": {
"text": "good for you"
},
"action": {
"cards": [
{
"card_index": 0,
"type": "cta_url",
"header": {
"type": "image",
"image": {
"link": "https://test-itnio-im.s3.us-west-2.amazonaws.com/im-img-file/4be035c4c37b4a6c8d40690ce27e5660.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20260310T034655Z&X-Amz-SignedHeaders=host&X-Amz-Credential=AKIAUTJFJ2APHYZXEONS%2F20260310%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Expires=86400&X-Amz-Signature=51eaa3dbcc3034fedea5e99e1c88b6410e9158615cf26b016fe3e022da175e60"
}
},
"body": {
"text": "*Blue Echeveria*nnA rosette-shaped succulent with powdery blue leaves, perfect for brightening up any space."
},
"action": {
"name": "cta_url",
"parameters": {
"display_text": "Buy now",
"url": "https://shop.luckyshrub.com/latest/blue-echeveria"
}
}
},
{
"card_index": 1,
"type": "cta_url",
"header": {
"type": "image",
"image": {
"link": "https://test-itnio-im.s3.us-west-2.amazonaws.com/im-img-file/4be035c4c37b4a6c8d40690ce27e5660.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20260310T034655Z&X-Amz-SignedHeaders=host&X-Amz-Credential=AKIAUTJFJ2APHYZXEONS%2F20260310%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Expires=86400&X-Amz-Signature=51eaa3dbcc3034fedea5e99e1c88b6410e9158615cf26b016fe3e022da175e60"
}
},
"body": {
"text": "*Zebra Haworthia*nnStriking white stripes on deep green leaves give this compact succulent a bold, modern look."
},
"action": {
"name": "cta_url",
"parameters": {
"display_text": "Buy now",
"url": "https://shop.luckyshrub.com/latest/zebra-haworthia"
}
}
}
]
}
}
}
快速回复按钮消息:
{
"appId": "lYOxMDYC",
"channelType": 0,
"recipient": "8618870556245",
"businessPhone": "12026693133",
"type": "interactive",
"interactive": {
"type": "carousel",
"body": {
"text": "Of course! Here are three of our latest arrivals, each under $25:"
},
"action": {
"cards": [
{
"card_index": 0,
"type": "cta_url",
"header": {
"type": "image",
"image": {
"link": "https://www.luckyshrub.com/assets/blue-echeveria.jpeg"
}
},
"body": {
"text": "*Blue Echeveria*nnA rosette-shaped succulent with powdery blue leaves, perfect for brightening up any space."
},
"action": {
"buttons": [
{
"type": "quick_reply",
"quick_reply": {
"id": "learn-blue-echeveria",
"title": "Learn more"
}
},
]
}
},
{
"card_index": 1,
"type": "cta_url",
"header": {
"type": "image",
"image": {
"link": "https://www.luckyshrub.com/assets/blue-echeveria.jpeg"
}
},
"body": {
"text": "*Blue Echeveria*nnA rosette-shaped succulent with powdery blue leaves, perfect for brightening up any space."
},
"action": {
"buttons": [
{
"type": "quick_reply",
"quick_reply": {
"id": "learn-blue-echeveria",
"title": "Learn more"
}
},
]
}
},
]
}
}
}
| 参数 | 说明 | 类型 |
|---|---|---|
| status | 状态码,0成功,其他失败参见响应状态码说明 | String |
| reason | 成功或失败描述 | String |
| data | 结果 | Object |
| messageId | 消息id | String |
| imestamp | 时间戳(秒级) | Long |
| channelType | 通道类型:0-WhatsApp,默认0; | String |
| status | 状态说明 |
|---|---|
| -68 | 余额不足 |
| -69 | 费率不存在 |
| -70 | 接收人号码长度不能大于14位 |
| -71 | 接收人号码长度不能小于7位 |
| -72 | 接收人号码格式错误,它必须为数字 |
| -93 | 商家号码长度不能大于14位 |
| -94 | 商家号码长度不能小于7位 |
| -95 | 商家号码必须为纯数字 |
| -96 | 商家号码不存在 |
| -97 | 商家号码状态错误 |
| -112 | channelType在参数中只能为0 |
| -114 | 文本消息text不能为空 |
| -115 | 文本消息的body不能为空 |
| -116 | 图片消息image不能为空 |
| -117 | 图片消息的link不能为空 |
| -118 | 音频消息audio不能为空 |
| -119 | 音频消息的link不能为空 |
| -120 | 视频消息video不能为空 |
| -121 | 视频消息的link不能为空 |
| -122 | 贴图消息sticker不能为空 |
| -123 | 贴图消息的link不能为空 |
| -124 | 文档消息document不能为空 |
| -125 | 文档消息的link不能为空 |
| -127 | 位置消息location不能为空 |
| -128 | 位置消息的longitude不能为空 |
| -129 | 位置消息的latitude不能为空 |
| -132 | 未知消息类型 |
| -133 | link链接地址格式错误 |
| -134 | parameter参数类型错误 |
| -135 | parameter的变量值不能为空 |
| -165 | 自定义互动消息类型必须是 list、button、location_request_message、carousel 中的一种 |
| -304 | 轮播交互消息不支持页眉和页脚组件 |
| -305 | 轮播交互消息只允许有2-10张卡片 |
| -306 | 轮播交互消息卡片索引值只能为0-9,从0开始不重复且连续 |
| -307 | 轮播交互消息卡片类型必须为"cta_url" |
| -308 | 轮播交互消息卡片页眉不能为空 |
| -309 | 轮播交互消息卡片页眉类型必须为image或video |
| -310 | 轮播交互消息卡片页眉媒体链接不能为空 |
| -311 | 轮播交互消息卡片正文文本不能为空,并且不能超过160个字符 |
| -312 | 轮播交互消息卡片操作按钮action不能为空 |
| -313 | 轮播交互消息卡片网址按钮名称必须为"cta_url" |
| -314 | 轮播交互消息卡片网址按钮参数不能为空 |
| -315 | 轮播交互消息卡片网址按钮参数display_text不能为空,并且不能超过20个字符 |
| -316 | 轮播交互消息卡片网址按钮访问网址不能为空 |
| -317 | 轮播交互消息卡片只能有1-2个快速回复按钮 |
| -318 | 轮播交互消息卡片快速回复按钮类型值必须为"quick_reply" |
| -319 | 轮播交互消息卡片快速回复按钮quick_reply参数不能为空 |
| -320 | 轮播交互消息卡片快速回复按钮quick_reply参数id不能为空,并且不能超过20个字符 |
| -321 | 轮播交互消息卡片快速回复按钮quick_reply参数title不能为空,并且不能超过20个字符 |
| -322 | 轮播交互消息卡片组件参数错误 |
| -329 | 轮播交互消息主消息正文不能为空"cta_url" |
| -330 | 轮播交互消息正文内容不能为空,且最大1024个字符 |
| -331 | 轮播卡片互动按钮类型只能是网址跳转或者快速回复中的一种 |
Java
PHP
REQUEST
package com.itniotech.api.demo.im;
import cn.hutool.core.map.MapUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.http.Header;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
private static void sendCustomMsg() {
final String baseUrl = "https://api.itniotech.com/wa/";
final String apiKey = "your api key";
final String apiPwd = "your api secret";
final String appId = "your appid";
final String url = baseUrl.concat("custom/sendMsg");
HttpRequest request = HttpRequest.post(url);
final String datetime = String.valueOf(LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant().getEpochSecond());
final String sign = SecureUtil.md5(apiKey.concat(apiPwd).concat(datetime));
request.header(Header.CONNECTION, "Keep-Alive")
.header(Header.CONTENT_TYPE, "application/json;charset=UTF-8")
.header("Sign", sign)
.header("Timestamp", datetime)
.header("Api-Key", apiKey);
final int channelType = 0;
final String businessPhone = "business phone"; //the business phone
final String recipient = "accept phone"; //accept phone
final String type = "text";
Map buildMap = MapUtil.builder("body", "this is body content").build();
String body = JSONUtil.createObj()
.set("appId", appId)
.set("businessPhone", businessPhone)
.set("channelType", channelType)
.set("recipient", recipient)
.set("type", type)
.set("text", buildMap)
.toString();
HttpResponse response = request.body(body).execute();
if (response.isOk()) {
String result = response.body();
System.out.println(result);
}
} REQUEST
header('content-type:text/html;charset=utf8');
$apiKey = "your api key";
$apiSecret = "your api secret";
$appId = "your appid";
$timeStamp = time();
$sign = md5($apiKey.$apiSecret.$timeStamp);
$headers = array('Content-Type:application/json;charset=UTF-8',"Sign:$sign","Timestamp:$timeStamp","Api-Key:$apiKey");
$url = "https://api.itniotech.com/wa/template/sendMsg";
$dataArr["appId"] = $appId;
$dataArr["businessPhone"] = "business phone";
$dataArr["recipient"] = "accept phone";
$dataArr["channelType"] = 0;
$dataArr["type"] = "text";
$dataArr["text"] = array(
"body" => "this is body content"
);
$data = json_encode($dataArr);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 600);
curl_setopt($ch, CURLOPT_HTTPHEADER,$headers);
curl_setopt($ch, CURLOPT_POSTFIELDS , $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
$output = curl_exec($ch);
curl_close($ch);
var_dump($output);
RESPONSEEXAMPLE
{
"status": "0",
"reason": "success",
"data": {
"channelType": 0,
"messageId": "10415ecbd0c848ebb7d5a3fe53269df6",
"timestamp": 1693813991
}
}