Send Message
Initiate Viber message sending via API.
- URL:
https://api-hk.nxlink.ai/saas/viber/send
- Method:
POST
- Content-Type:
application/json
- Requires authentication:
Yes
Authentication
Authentication rules: API Invocation Convention
Request Parameters
Header Parameters
| Parameter |
Type |
Required |
Example |
Description |
| accessKey |
String |
Yes |
fme2na3kdi3ki |
User identity key |
| ts |
String |
Yes |
1655710885431 |
Timestamp in milliseconds. Max allowed time drift is 60 seconds. |
| bizType |
String |
Yes |
7 |
Viber business type, fixed value "7" |
| action |
String |
Yes |
mt |
Viber action, fixed value "mt" |
| sign |
String |
Yes |
6e9506557d1f289501d333ee2c361111 |
Signature, see common auth rules |
Body Parameters
| Parameter |
Type |
Required |
Example |
Description |
| tenant_id |
Long |
Yes |
1 |
Tenant ID |
| appkey |
String |
Yes |
pem28kje |
Application appkey |
| to |
String |
Yes |
86158xxxx1795 |
Recipient Viber number with country code |
| type |
String |
Yes |
1 |
Supported message types: text, image, text+image, text+button, text+image+button |
| filename |
String |
No |
- |
Required when message includes image |
| fileUrl |
String |
No |
- |
Required when message includes image |
| content |
String |
No |
- |
Required when message includes text |
| viber_video_button_info |
Object |
No |
- |
Required when message includes button |
| tag_id |
Long |
No |
- |
Tag ID |
Message Types
- 1: text
- 3: image
- 10: text + image
- 12: text + button
- 11: text + image + button
viber_video_button_info
| Parameter |
Type |
Required |
Example |
Description |
| button_text |
String |
No |
- |
Button text, required when type=11/12 |
| button_link |
String |
No |
- |
Button link, required when type=11/12 |
Request Examples
Text
{
"tenant_id": 123,
"appkey": "Exxx",
"to": "86137xxxx",
"type": 1,
"content": "Text message"
}
Image
{
"tenant_id": 123,
"appkey": "Exxx",
"to": "86137xxxx",
"type": 3,
"filename": "7PSg8pGsIuWfHJZ.jpg",
"fileUrl": "https://nxtele-hk.oss-cn-hongkong.aliyuncs.com/6.5M.jpeg?Expires=1706089776&OSSAccessKeyId=TMP.3KhCyAyQVWhZt6N1prT69KjWMhXRDFQ5Ad5bj4BNkAx8TC3RuvXofqDdgunV9gQtDJk91X8n7kuypNJRBTJPhtqTcViaa5&Signature=%2FHvdJziTm2eaeqvTW7Y5VVxA5ZA%3D"
}
Text + Image
{
"tenant_id": 123,
"appkey": "Exxx",
"to": "86137xxxx",
"type": 10,
"filename": "7PSg8pGsIuWfHJZ.jpg",
"fileUrl": "https://s2.loli.net/2024/01/24/7PSg8pGsIuWfHJZ.jpg",
"content": "Text with image"
}
Text + Button
{
"tenant_id": 123,
"appkey": "Exxx",
"to": "86137xxxx",
"type": 12,
"content": "Text with button",
"viber_video_button_info": {
"button_text": "Button text",
"button_link": "https://www.baidu.com"
}
}
Text + Image + Button
{
"tenant_id": 123,
"appkey": "Exxx",
"to": "86137xxxx",
"type": 11,
"filename": "7PSg8pGsIuWfHJZ.jpg",
"fileUrl": "https://s2.loli.net/2024/01/24/7PSg8pGsIuWfHJZ.jpg",
"content": "Text + image + button",
"viber_video_button_info": {
"button_text": "Button text 1",
"button_link": "https://www.baidu.com"
}
}
Response Parameters
| Parameter |
Type |
Description |
| code |
Integer |
Result code |
| data |
JsonObject |
Result data |
| message |
String |
Message |
| traceId |
String |
Trace ID |
data object
| Parameter |
Type |
Description |
| message_id |
String |
Message ID |
Response Examples
Success
{
"code": 0,
"message": "",
"data": {
"message_id": "gBGGhSNXV1dfAglVQ0RRuE3YWhc"
},
"traceId": "56bf81643292cd6a89ecde64ae00db13"
}
Failure
{
"code": -1,
"message": "Failure",
"traceId": "77f8709b545f4fee93fd7f098be9df04"
}
Response Codes
| Code |
Message |
Solution |
| 0 |
Success |
- |
| -1 |
Failure |
Contact support |
| 1000~100X |
Authentication failed |
See authentication section |
| 1100 |
Customer does not exist / Status is unavailable |
Contact business team |
| 1102 |
Insufficient balance |
Contact business team |
| 9000 |
Request parameter error |
Check required parameters |
| 9001 |
System business error |
Contact support |
| 9002 |
Phone number error |
Check phone number |
| 9003 |
Customer APP does not exist / Status is unavailable |
Contact business team |
| 9004 |
Customer APP does not have quotation |
Contact business team |
| 9005 |
Missing customer APP routes |
Contact support |
| 9011 |
Customer APP quotation currency error |
Contact support |
| 9999 |
Unknown error |
Contact support |