Registration in Twilio
Register on https://www.twilio.com/.
After registration you get your twilio number by clicking on " Get your Twilio number "
.
For using the API Twilio you need AccountSid and AuthToken.
You can get them by clicking on " Show API Credentials "
SMS
Click Use this process and template Twilio "SMS" will copy to your environment.
There are two processes in the folder:
1) "Sending SMS"
- for sending SMS via API Twilio
2) "Getting callback"
- for getting callback by the status of sent SMS
How it works
The first process sends SMS and copies the request with the new reference {{sid}}
(message id) in the second process for getting callback.
The second process receives a callback from Twilio and updates the request in the first process adding a status of the message.
For SMS via API Twilio and getting a callback, go through the following the steps in your cloned processes :
1) In the process of " Getting callback "
get a callback url.
In edit mode of the logic api_callback
node"Callback"
click onCreate callback url
By clicking on the icon ‘corezoid’ callback url will be copied to the clipboard.
2) In the process of " Sending SMS "
add the received callback url in the parameter value of the node StatusCallback`` "Calling API"
.
At the same time it is IMPORTANT:
In the received url you need to replace the word "callback" for "plugins / twilio"
For example, it is received a callback url - https://corezoid.com/api/1/json/callback/559a817f4b8ff96bf5000b/cb9f670f5c223ec42e1
In the parameter value StatusCallback
we add -
https://corezoid.com/api/1/json/plugins/twilio/559a817f4b8ff96bf5000b/cb9f670f5c223ec42e1
For sending SMS via API Twilio switch to the dashboard
mode of the process "Sending SMS"
and click on Add task
- adding of the request.
In the appeared window, indicate:
- AuthToken - Your AuthToken
- AccountSid - Your AccountSid
- Number_to - recipient's phone number with " + "and the country code
- Number_from - Your phone number Twilio
- Body - text of the message (up to 1600 characters)
And then click on " Send task "
for sending the request.
The result will be passing of the request through the process and the transition in one of the final states (red node).
The process is prepared for using out of other processes through the RPC logic.
In case of success the parameter will be added to the request.
status
- message statussid
- unique message identifier
In case, if API Twilio returns an error, the request will go to the node of escalation and following parameters will be added:
code
- error code Twiliomessage
- text error Twiliourl_more_info
- link to the website Twilio, where there is a detailed description of the caused error.
In case of error call API Twilio , the request will go to the node of escalation and following parameters will be added:
code
- code errormessage
- text error
Useful links Twilio: