We use cookies to improve your experience on this site and serve more relevant content to you. By continuing to browse our site you agree to our use of cookies, revised Privacy Policy and Terms of Service.  More information about cookies

Sending Viber message

POST https://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
Field to
Type string
Description Destination address (recipient)
Field from
Type string
Description Source address (originator), The from approved in advance by VertexSMS. You can register new from via the senderID API.
Field message
Type string
Description Message body. Max. text length is - 1000 charters.
Optional parameters
Field
Type
Description
Field dlrUrl
Type url
Description 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.
Field priority
Type string
Description Change priority of sms. Possible values:
high - use this for registration forms, password reminders and other important sms.
normal - default priority for sms’es
low - use this priority for mass messages
Field scheduled
Type string
Description MSchedule message sending in specified time. Date and time must be set in ISO 8601 ex.: 2015-01-01T13:00:00+02:00
Field testMode
Type string
Description Use this to test API without sending real message to handset. Possible values:
1 - Use this value to emulate success delivery
2 - Use this value to emulate failed delivery
Field correctBy
Type string
Description 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:

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:

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" : {
        "url" : "https://example.com",
        "title" : "go to example.com"
    }
}
Button parameters
Field
Type
Description
Field url
Type url
Description The value should be a valid URL address
Field title
Type string
Description Title of the button

Request example:

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" : {
        "url" : "https://example-cdn.com/image.png"
    }
}

The image option could be combined with the button settings

"im" : {
    "action" : {
        "url" : "https://example.com",
        "title" : "go to example.com"
    },
    "image" : {
        "url" : "https://example-cdn.com/image.png"
    }
}
Image parameters
Field
Type
Description
Field url
Type url
Description 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:

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"
        }
    }
}