SMS Alerts API

Whatsapp Alerts#

Twilio configuration in Shunya#

ConfigDescription
Account SIDAccount SID from the Twilio console
Auth TokenAuthorization Token from the Twilio console.

The configurations need to be set manually by the user before using the API's

For example:

A sample JSON snippet should contain

"twilio": {
"twilioAccountSid": "",
"twilioAuthToken": ""
},

Commonly configured parameters#

For example:

A typical Twilio configuration will look like this

"twilio": {
"twilioAccountSid": "xxxxxxxxxxxxxx",
"twilioAuthToken": "xxxxxxxxxxxxxxx"
},

API#

APIDescriptionDetails
newTwilio()Create new Twilio Instance.Read More
sendWhatsappTwilio()Send Whatsapp Message via Twilio API.Read More

newTwilio()#

Description : Creates a new Twilio Instance

Parameters

  • name (char *) - Name of the JSON object.

Return-type : twilioObj

Returns : twilioObj Instance for Twilio

Usage :

For example: Lets say your /etc/shunya/config.json JSON file looks like

"twilio1": {
"twilioAccountSid": "xxxxxxxxxxxxxx",
"twilioAuthToken": "xxxxxxxxxxxxxxx"
},

So the usage of the API's will be

twilioObj whatsapp = newTwilio("twilio1");

sendWhatsappTwilio()#

Description: Send Whatsapp Message via Twilio API.

Parameters

  • obj(twilioObj) - the Twilio Instance Object.
  • from_number(int) - the sending (Number in your Twilio account).
  • to_number(int) - the Receiving mobile number.
  • msg(char *) - the msg to be sent.

Return-type : int8_t

Returns: 0 on Success and -1 on Failure.

Usage :

twilioObj whatsapp = newTwilio("twilio1");
sendWhatsappTwilio(whatsapp,"+911765765789","+911475289631",
"Temperature is above %d deg C", temp);