

SEND SMS NODE JS INSTALL
To interact with the SMS, let's install the package for Node.js: yarn add twilio Create a client SDKĪ client SDK is an instance of the SDK with the credentials configured, so the API will know who is performing the request. There is an SDK for each language supported by Twillio services, to interact with their API from your own source. env.example you can duplicate to create your local. This file is excluded from the Git version, but there is a template called. When you launch your application, all the variables located in the file '.env' are injected into the node process. The project comes with the support of environment variables, thanks to dotenv. Navigate to the URL to verify it works as expected. Let's clone it and launch it locally: git clone -b express node-otp-twilio
SEND SMS NODE JS CODE
The application will expose two endpoints to respectively send a unique code by SMS and verify the code received by SMS. I created a boilerplate to quickly start a Node.js project with Express Framework. We will need it in our Node.js application. Click on the button "Provision and add this number".Ĭopy this number and keep it somewhere because we will need it later alternatively, you can go to the menu "Phone Numbers" in the left sidebar to find it.įrom this page, copy the account SID and the Auth Token. Next, click on the link labeled "Get set up".Įnter the Messaging service name and click on the button "Create Messaging Service"Ī phone number will be generated for you and displayed in the next step. On the dashboard, go to the left sidebar and click on the menu "Messaging" => "Overview". There is no need to follow the steps shown on the page since we will see them in this tutorial. You will reach the dashboard, which is the end of this part. Choose the same answer as in the picture below. Once your phone number is verified, the last step is to provide some information about your goal for using Twilio. When you enter your phone number and click on the button "Verify", you will receive an SMS with a code to enter on the next page.

Once your email is confirmed, you will need to provide a phone number for verification. You will receive an email in your inbox to verify your account. Fill the inputs with your information and click on the button "Start your free trial".
