Sending Viber message
POSThttps://api.vertexsms.com/viber
Submits viber message(s) for sending. If successful - returns HTTP status code 200 OK and an array of IDs of messages added to the sending queue.
Required parameters
| Field | Type | Description |
|---|---|---|
| to | string | Destination address (recipient) |
| from | string | Source address (originator), The from approved in advance by VertexSMS. You can register new from via the senderID API. |
| message | string | Message body. Max. text length is - 1000 charters. |
Optional parameters
| Field | Type | Description |
|---|---|---|
| dlrUrl | url | Where to transfer delivery report of each submitted message. Delivery report will contain the same message ID, which is returned after submitting the message for sending. |
| priority | string | Change priority of sms. Possible values:
|
| scheduled | string | MSchedule message sending in specified time. Date and time must be set in ISO 8601 ex.: 2015-01-01T13:00:00+02:00 |
| testMode | string | Use this to test API without sending real message to handset. Possible values:
|
| correctBy | string | Fix recipient number by a given country. Example: fix the 6xxxxxxx to 3706xxxxxxx if LT country iso passed.Possible value: country code in ISO 3166-1 alpha-2 format |
Request example:
REQUEST EXAMPLEPOST
POST /viber HTTP/1.1
Host: api.vertexsms.com
Content-Type: application/json
Accept: application/json
X-VertexSMS-Token: eB52vNTPL9fO3rDrx8pYmVnj6nqceHNhnqceHNh
{ "to": "37069912345", "from": "Test", "message": "Test Viber message" }
Response example:
RESPONSE · 200 OK
HTTP/1.1 200 OK
Content-Type: application/json
Cache-control: no-cache
X-VertexSMS-Amount-Sent: 1
["1281532560"]
Button
To send the message with the button requires providing additional parameters as part of the interactive message (im) settings option
IM ACTION STRUCTURE
"im" : {
"action" : {
"url" : "https://example.com",
"title" : "go to example.com"
}
}
Button parameters
| Field | Type | Description |
|---|---|---|
| url | url | The value should be a valid URL address |
| title | string | Title of the button |
Request example:
REQUEST EXAMPLEPOST
POST /viber HTTP/1.1
Host: api.vertexsms.com
Content-Type: application/json
Accept: application/json
X-VertexSMS-Token: eB52vNTPL9fO3rDrx8pYmVnj6nqceHNhnqceHNh
{
"to" : "+370...",
"from" : "Test",
"message" : "Hello World!",
"im" : {
"action": {
"url" : "https://example.com",
"title" : "go to example.com"
}
}
}
Image
To send the message with the media requires providing additional parameters as part of the interactive message (im) settings option
IM IMAGE STRUCTURE
"im" : {
"image" : {
"url" : "https://example-cdn.com/image.png"
}
}
The image option could be combined with the button settings
COMBINED IMAGE + BUTTON
"im" : {
"action" : {
"url" : "https://example.com",
"title" : "go to example.com"
},
"image" : {
"url" : "https://example-cdn.com/image.png"
}
}
Image parameters
| Field | Type | Description |
|---|---|---|
| url | url | URL of the image (JPEG, PNG, non-animated GIF). The URL must have a resource with a .jpeg, .png or .gif file extension as the last path segment. Max image size: 1MB |
Request example:
REQUEST EXAMPLEPOST
POST /viber HTTP/1.1
Host: api.vertexsms.com
Content-Type: application/json
Accept: application/json
X-VertexSMS-Token: eB52vNTPL9fO3rDrx8pYmVnj6nqceHNhnqceHNh
{
"to" : "+370...",
"from" : "Test",
"message" : "Hello World!",
"im" : {
"image" : {
"url" : "https://example-cdn.com/image.png"
},
"action": {
"url" : "https://example.com",
"title" : "go to example.com"
}
}
}