Sending message to Viber
To start sending messages via HTTP API, do the following:
- Refill your balance, if it’s empty;
- Generate a new API key. You can have as much as 5 of them and create/delete them at any time;
- State your IP (single, several, or range) that the requests will be coming from.
HTTP API URL:
http://api.sms.intel-tele.com/im/send/
Request params:
Parament | Description | Required |
username |
Yes | |
api_key |
Yes | |
to |
Destination address. Several destinations can be provided, separated by comma (“,”) | Yes |
im_sender |
Sender that a message appears to come from | No |
im_message |
Urlencoded message body. A long message will be 1000 symbols | Yes |
im_image |
Urlencoded link to image. The image size should not exceed 400x400px. Format: jpg/jpeg/png (format must be lowercase). Use together with im_button_link and im_button_text | No |
im_button_text |
Urlencoded button text. Use together with im_button_link | No |
im_button_link |
Urlencoded link to redirect on click to im_button_text | No |
im_ttl |
TTL (number of seconds). Min – 60. Max – 86400. Default – 60 | No |
If number does not have Viber account you can use a possibility to send your message in this number as SMS with alternative Sender ID and message content. To do it you need:
- sms_source – optional, a sender addr that a alternative message appears to come from. Use together with sms_message. Can be one of the following: “fully numeric, up to 15 digits, not less than 3 digits”, “alpha-numeric, up to 11 latin symbols, not less than 3 symbols”
- sms_message – optional, urlencoded message body. A long message will be split into multiple sms. The price of the message will be multiplied by parts count. Use together with sms_source.
Example request:
curl “http://api.sms.intel-tele.com/im/send/?username=foo&api_key=bar123&to=7123456789&im_sender=IntelTele.com&im_message=Test+123&im_image=https%3A%2F%2Fintel-tele.com%2Fimages%2Flogo.png&im_button_text=Click&im_button_link=https%3A%2F%2Fintel-tele.com&im_ttl=120”
Example response:
{“reply”: [{“status”: “OK”, “cost”: “0.200000”, “country”: “ru”, “mcc”: “250”, “number”: “7123456789”, “message_id”: “3c32257b-e0b8-4be9-b0e6-e871116b4bdf”}]}
The response of our system is JSON, and can be one of the following:
errors for the whole request:
{'reply':[{'status': 'error: wrong username/api_key'}]} |
the auth is wrong |
{'reply':[{'status': 'error: wrong api key'}]} |
the api key does not match |
{'reply':[{'status': 'error: bruteforcing detected'}]} |
too many unauthorized requests had been made, this IP will be blocked for 5 minutes |
{'reply':[{'status': 'error: ip not allowed'}]} |
the request initiator’s IP is not listed in our system |
{'reply':[{'status': "error: can't send message"}]} |
some of the required params are missing |
{'reply': [{'status': 'error: message is too long'}]} |
the message length exceeds allowed 1000 symbols |
{'reply':[{'status': "error: sender is banned"}]} |
we are trying to prevent spam. For clarifications, please contact technical support |
errors per submitted number:
{"reply": [{"number": "7123456789", "status": "error: number is blacklisted"}]} |
the subscriber had chosen to opt-out from receiving the messages. For clarifications, please contact technical support |
{"reply": [{'number': '7123456789', 'status': "error: repeat detected"}]} |
a message has been blocked from being repeatedly sent to the same number within 1 minute |
{'reply':[{'number':'7123456789', 'status':"error: can't determine country"}]} |
the country of the given number can’t be determined |
{'reply':[{'number':'7123456789', 'status':"error: no route to country"}]} |
your profile has no active route to this number’s country |
{'reply':[{'number':'7123456789', 'status':"error: low balance", 'cost':'0.04'}]} |
not enough balance |
success response per sms:
{"reply": [{"status": "OK", "cost": "0.186440", "country": "ru", "mcc": "250", "number": "7123456789", "message_id": "3c32257b-e0b8-4be9-b0e6-e871116b4bdf"}]} |
the message has entered the outgoing queue, msgid is ‘f3e76f4e-d4e3-424b-b26b-c0ebc72892cd’, message consists of 1 part! |
Field values:
status |
Send status, “OK” means that the message was correctly processed and queued for sending to an external SMS provider. |
cost |
SMS cost per number |
number |
the number for which the status is transmitted. if there are several numbers, then everyone will have their own hash “{}” inside the “reply” list |
message_id |
The message id assigned by the system. will be transmitted in asynchronous calls of the status handler |
country |
two-letter country code, ISO 3166 code list |
mccmnc |
country code, Mobile Country Code |
Asynchronous MT messages status
Provide us with the URL and method (GET or POST) in order to receive the message statuses to your system asynchronously.
Our request will have the following params:
msgid |
the ID of the message that our system assigned earlier at submit, e.g. f3e76f4e-d4e3-424b-b26b-c0ebc72892cd |
status |
can be one of the following:
|
datetime |
the timestamp when the status has been received by or system. The timezone is UTC |
Synchronous MT messages status
URL (for GET or POST):
http://api.sms.intel-tele.com/im/status/
Request parameters:
Parameter | Description | Required |
username | Yes | |
api_key | Yes | |
timeformat | Urlencoded. Defines the format of the status timestamp. [datetime, date, time]. If not set, no timestamp will be passed in the response. For example, timeformat=’datetime’ will yield this date: 2017-01-23 12:34:56 | No |
timezone | Urlencoded. Please refer to the list of available timezones. If not set, the timezone from your profile will be used. | No |
Example request:
curl “http://api.sms.intel-tele.com/im/status/?username=foo&api_key=bar&requests=3c32257b-e0b8-4be9-b0e6-e871116b4bdf&timezone=UTC&timeformat=datetime”
Example response:
{“3c32257b-e0b8-4be9-b0e6-e871116b4bdf”: {“date”: “17-02-2013 12:08:29”, “status”: “rejectd”, “time_zone”: “UTC”}}
Balance checking
URL (for GET or POST):
http://api.sms.intel-tele.com/balance/
Request parameters:
Parameter | Description | Required |
username |
Yes | |
api_key |
Yes |
Request example:
curl “http://api.sms.intel-tele.com/balance/?username=foo&api_key=bar”
Response example:
{“balance”: “-0.42”}
Credit checking
URL (for GET or POST):
http://api.sms.intel-tele.com/credit/
Request parameters:
Parameter | Description | Required |
username |
Yes | |
api_key |
Yes |
Request example:
curl “http://api.sms.intel-tele.com/credit/?username=foo&api_key=bar”
Response example:
{“credit”: “1.23”}
Rates
URL (for GET or POST):
http://api.sms.intel-tele.com/rates/
Request parameters:
Parameter | Description | Required |
username |
Yes | |
api_key |
Yes |
Request example:
curl “http://api.sms.intel-tele.com/rates/?username=foo&api_key=bar”
The response of our system is JSON, and can be one of the following:
errors for the whole request:
Field | Description |
{'message': 'Invalid auth', 'error': true} |
the auth is wrong |
{'status': 'bruteforcing detected', 'error': true} |
too many unauthorized requests had been made, this IP will be blocked for 5 minutes |
{'status': 'ip not allowed', 'error': true} |
the request initiator’s IP is not listed in our system. |
success response:
{“user”: {“ru”: {“01”: [0.123456, 0], “”: [0.234567, 0]}}}
Field | Description |
user |
username |
ru |
country ISO-code |
"01": [ 0.123456, 0 ], |
MNC Network: 1st param: price per 1 sms 2nd param: 0: pay for all sms, 1: pay only for delivered sms * empty key – all networks |