Twilio
This guide explains how you can use the Twilio REST API to send SMS. After completing this step-by-step tutorial, you can use your cloud code function to send SMS to your device.
To complete this tutorial, you will need:
- An app created at Back4App.
- Back4App Command Line Configured with the project.
Below are some steps you need to follow when writing a function to send SMS to a User and phone number.
To learn how to create or access an Account in Twilio, check the links given below:
After logging in or creating a new account, you will be redirected to your Project. There, on the left, you need to click on the #Phone Numbers. Next, tap on the last link âGetting Startedâ, and then click on the button âGet your first Twilio phone numberâ. Same as shown below:
After that you will receive your first Phone Number for your Twilio Account. If you canât find your phone number, go to #Phone Numbers and Manage Numbers.
To find your Account SID and Auth Token, log in to your Account, go to your Dashboard and click on Settings. All the important information about your Project will be available in that section; as shown in the image below:
Now, you can Copy your SID and Authentication Token for the Cloud Code.
After configuring the environment for the Command Line Interface in your computer, create a file called package.json, and inside this file, you need to install the Twilio module, like:
You can also test the function in client SDKs, but for now, we will use the REST API command to send it:
And the result will be something like as this:
With the guide described above, youâll be able to use Twilio with a Cloud Code Function in Back4App and send SMS to your customers!
In case you need any help or a function/link doesnât work, please contact our team via chat!