Twilio
Twilio is a widely-used global connectivity service provider based in California, known for its reliability and coverage in many countries, particularly the US, Canada, and the UK.
To use Twilio as an SMS gateway in Navixy, you'll need to obtain your ACCOUNT_SID
and AUTH_TOKEN
(or API_SID
/API_SECRET
pair), which you can acquire by registering a Twilio account. These credentials are necessary for authentication and must be included in the JSON configuration for the Twilio gateway in the 'sms_gates' table of the 'google' database.
Navixy JSON configuration for Twilio
Navixy JSON configuration for Twilio is a set of parameters that are required to configure the Twilio SMS gateway in Navixy. These parameters are defined in JSON format and stored in the 'params' field of the 'sms_gates' table in the 'google' database.
Recommended configuration with account_sid
and auth_token
:
field params:
{
"account_sid": "ACdc5f132a3c49700934481addd5ce1659",
"auth_token": "1095175a27d2044c06e1db8577b484f3",
"enable_status_callback": false
}
type: transceiver
provider: twilio
or, alternatively, with account_sid
, api_sid
, api_secret
:
field params:
{
"account_sid": "ACdc5f132a3c49700934481addd5ce1659",
"api_sid": "SK12347865ugdfjbdf7845876345",
"api_secret": "BS12347865ugdfjbdf7845876345",
"enable_status_callback": false
}
type: transceiver
provider: twilio
To locate your Twilio 'account_sid' and 'auth_token', log in to your Twilio dashboard and click on 'Show API Credentials' to access your account information.
SQL queries to execute
To update the database with the correct settings for using Twilio as an SMS gateway, use the following SQL query:
INSERT INTO google.sms_gates (type, provider, params, enabled, class_filter) VALUES ('transceiver', 'twilio','{"account_sid": "ACdc5f132a3c49700934481addd5ce1659","auth_token":"1095175a27d2044c06e1db8577b484f3", "enable_status_callback": true}',1,'*');
Sender phone number
To configure the phone number provideded by Twilio execute two additional SQL queries:
UPDATE google.dealers SET master_phone="TWILIO_PHONE", from_sms="TWILIO_PHONE" WHERE dealer_id=1;
INSERT INTO google.sms_gates_to_dealers (dealer_id, gate_id) VALUES (0, 1);
TWILIO_PHONE
stands for the phone number you have leased from Twilio. The first SQL query adds the phone number that will be used in the 'from' field with Twilio API. The second query one links the SMS gateway with the dealer (PaaS) account.
Incoming messages
To get incoming messages via Twilio provider add the following URL into their configuration interface:
http://$IPADDR:22000/sms/$GATEID/incoming
Where
$IPADDR
- is an ip address of the server or its domain name$GATEID
- id of sms gate which is processing incoming messages22000
- port used to listen connects (default value)
Known issues with Twilio
When using the Twilio SMS gateway with Navixy, there is a potential issue with SMS commands that contain leading spaces. In some cases, Twilio may remove these spaces when processing the message, which can result in a failure to execute the intended command.
For example, if you send an SMS command to a device with a leading space, such as " 123456"
, Twilio may remove the space and send the command as "123456"
to the device. If the device requires the space to be present in order to recognize the command, it will not be executed properly. This can cause confusion and frustration for both users and system administrators.
Specifically, this issue was confirmed with Teltonika and Ruptela devices when the password for protecting configuration is not set on the device.
To avoid this issue, we recommend using alternative SMS connectivity provides, such as Vonage or Textlocal.