Setting up Twilio
1
Create a Twilio Account
- Go to Twilio and create an account, starting with their free trial.
- You’ll be asked to verify your email and your phone number. Get them verified.
2
Get a Twilio Phone Number
- Once verified, you’ll get an option to ‘get a Twilio phone number’ from your Twilio console.
- Click on it to get your Twilio phone number.
When first using Twilio there should be an option to get a Twilio phone number in the main
console. Otherwise, you may have to
Buy
a number to begin using it. For first-time users, utilize the free number provided.
3
Understand the Key Components
Irrespective of the language you use, the process requires:
- Account SID and Auth token loaded into the code using secure environment variables
- A Twilio client object that takes the SID and Token as variables
- A message object containing:
- Your Twilio phone number
- The recipient’s phone number
- The SMS message body
Creating a Twilio integration with Novu
1
Connect Twilio to Novu
- Visit the Integrations Store on Novu
- Click the “Add a provider” button
- Locate Twilio and click on the
Disabledbutton and mark it asActive - Click on the Connect button
2
Configure Twilio Credentials
- Go to your Console on Twilio and access the Account Info section
- Enter your:
Account SIDAuth TokenTwilio Phone NumberData residency region(optional) — leave as US (default) unless your Twilio account uses EU data residency
- Click on the Save button
Multi-region data residency
Twilio supports processing and storing SMS data in specific regions. Novu lets you choose the API region when connecting your Twilio integration.EU data residency requires IE1-specific credentials from the Twilio Console and senders configured for the IE1 region. See Twilio’s Messaging API with Twilio Regions guide for setup details.
Configure EU data residency
1
Create IE1 API credentials
In the Twilio Console, create API credentials for the IE1 region. Use those credentials in your Novu Twilio integration instead of your US credentials.
2
Configure senders for IE1
If you send with phone numbers, set each number’s active messaging region to IE1 in the Twilio Console under Numbers & Senders.
3
Select EU in Novu
When connecting or updating your Twilio integration in Novu, set Data residency region to EU (Ireland) and save your IE1 credentials.
Sending WhatsApp message
To send WhatsApp messages with Twilio integration, prefix the phone number of the subscriber withwhatsapp: as shown below:
- Node.js
- Python
- Go
- PHP
- .NET
- Java
- cURL
Sending WhatsApp template message
To send WhatsApp template messages with Twilio integration, you can use thetemplate field in the overrides object.
- Node.js
- Python
- Go
- PHP
- .NET
- Java
- cURL
Read more about sending a Message with the Twilio API for
WhatsApp.