Api for SMS Chat. Used to send SMS and read SMS history. Documentation is at https://sms-api.voipex.io/documentation/
Authentication is through bearer token - same as for IPBX-API:
https://ipexas.atlassian.net/wiki/spaces/VD/pages/626720808/Getting+Started+with+the+API+PBX#Working-with-IPBX-API.
Token can be set in documentation:
For SMS sending, you need to order mobile numbers - please contact sales. You can get list of your numbers by calling GET on SMS/allowed-numbers
:
curl -X GET "https://sms-api.voipex.io/SMS/allowed-numbers" -H "accept: application/json" -H "Authorization: Bearer eyJhbGci...Oi5c"
For allowed numbers (e.g. +420777888999) you can call POST on /SMS
:
curl -X POST "https://sms-api.voipex.io/SMS" -H "accept: application/json" -H "Authorization: Bearer eyJhbGci...Oi5c" -H "Content-Type: application/json" -d "{\"from\":\"+420777888999\",\"to\":\"+420607608609\",\"text\":\"Hello world!\"}"
On received SMS or delivery notification, your webhook is called, or email is sent. It depends on your SMS Chat settings. Webhook parameters are:
id: string
from: string
to: string
text: string
direction: IN | OUT
state: FAILED | DELIVERED
createdAt: string
All sent and received SMS can be read by GET /SMS
. History is maintained for 6 months. Time must be specified in ISO-8601 including timezone specification.
curl -X GET "https://sms-api.voipex.io/SMS?startTime=2021-09-01T00%3A00%3A00.000%2B02%3A00&endTime=2021-10-01T00%3A00%3A00.000%2B02%3A00" -H "accept: application/json" -H "Authorization: Bearer eyJhbGci...Oi5c"
Another option for sending SMS without mobile numbers is sending through central restapi. For authentication get bearer token:
With this token use route POST /v1/SMS:
curl -X 'POST' 'https://restapi.ipex.cz/v1/sms' \ -H 'accept: application/json' -H 'Content-Type: application/json' \ -H 'Authorization: Bearer TOKEN' -d '{ "from": "222333444", "to": "777888999", "message": "Message text", "email": "delivery@yourdomain.com" }' |
Where 222333444 is some number from your trunk (will be used to billing), 777888999 is target number and email is used for delivery notification. On target phone SMS will have sender number 60030. Alternatively, when you have registered your own sender name, you can pass argument “shortname“ with that name.