Before beginning, you will need to create and set up a Twilio account. This includes signing up and obtaining the necessary information (like the Account SID, Twilio phone number and authentication credentials), which will be used to connect the two platforms.
To connect Twilio to your website, you can navigate to Website Settings and select Applications. Afterwards, click on the Add Application button and select Twilio from the list of integrations.
Once that’s done, you will be presented with two authentication types - Auth Token and API Key. Depending on your preference, select one and then add all of the required details.
Obtaining Auth Token credentials (recommended)
1) Log into your Twilio account
2) Under Account Dashboard, you’ll find the Account Info section which houses the Account SID and Auth Token
Obtaining API Key credentials
1) Log into your Twilio account
2) Navigate to the top right corner where the Account Admin menu is, and select Account Management
3) In the left-side menu, under Keys & Credentials, click on API keys & tokens and then obtain your Account SID from the Live credentials section
4) To initiate the key creation, click on the Create API key button
5) Enter a friendly name for your API key, and change the region and type, if needed
6) Copy the secret as it won’t be accessible later on
Obtaining a Twilio phone number
The Twilio Number is simply a phone number (also known as a "Sender") that your messages will be sent from. You can either obtain a number from Twilio or port your own number to Twilio which would then allow you to send SMS and WhatsApp communications through our platform.
Your can purchase and manage your Phone Numbers in the Twilio Console here.
Obtaining an SMS Sender ID
The SMS Sender ID is a personalised Alphanumeric Sender ID (e.g.: YourCompanyName) that SMS messages can be sent from instead of a Twilio Number, and will appear on the SMS as the sender. Alphanumeric Sender IDs are used primarily for branding, and must be registered with Twilio.
Please note that Alphanumeric Sender IDs are designed for one-way communication, and your recipients will not be able to send replies to SMS messages sent with an Alphanumeric Sender ID.
Your can create and manage your Alphanumeric Senders in the Twilio Console here.
Obtaining a Messaging Service SID
A Twilio Messaging Service is a "bundle” of messaging functionality, which groups together common senders, features, and configurations for specific use-cases or messaging campaigns.
You can assign multiple different types of senders to a Messaging Service, and when sending messages, the Messaging Service will automatically choose the appropriate sender from its Sender Pool based on the message type, sender capacity, and recipient location.
Twilio Messaging Services are ideal for bulk messaging, as they are scalable and allow you to add more senders to your Sender Pool as your message volumes increase, as the number of messages that can be sent by an individual sender per second is limited. There is no additional cost associated with creating or using a Messaging Service, and it is recommended that you use a Messaging Service for sending SMS and WhatsApp messages due to the benefits and features they offer.
You can create and manage your Messaging Services in the Twilio console here.
Test Number
The Test Number is an optional number that you can send test messages to. You can use your own phone number as a test number and this will allow you to easily and conveniently send draft and test messages to yourself, without having to add yourself as a Contact.
Sending Messages
Depending on the type of message you are sending, your message will be sent from either the Twilio Number, the SMS Sender ID or the Messaging Service that you specified in your Twilio Settings.
Sending SMS
To send SMS messages you will need to provide either a Twilio Number OR an SMS Sender ID, OR a Messaging Service SID.
If provided, the SMS Sender ID will take precedence over the Twilio Number and the SMS will be sent from the SMS Sender ID.
And likewise, if provided, the Messaging Service will take precedence over both the Twilio Number and/or the SMS Sender ID, and the SMS will be sent via the Messaging Service, which will choose the appropriate sender to send the message from.
Sending WhatsApp
To send WhatsApp messages you will need to provide either a Twilio Number OR a Messaging Service SID. You will also need to create a WhatsApp Sender for your Twilio Number in the Twilio Console and link it to your WhatsApp Business Account.
A WhatsApp Sender is simply a sender that WhatsApp messages are sent from and can be the same number you use to send SMS messages.
If you are using a Messaging Service, you will need to add your WhatsApp Sender to your Messaging Service’s Sender Pool. This can be done from here.
As with SMS messages, if provided, the Messaging Service will take precedence over the Twilio Number, and the message will be sent via the Messaging Service, which will choose the appropriate WhatsApp sender to send the message from.
You can create and manage your WhatsApp Senders in the Twilio console here.
Sending Voice
To send Voice messages, you will need to provide a Twilio Number.
Receiving Messages
To receive SMS or WhatsApp messages, simply check the “Receive Incoming Messages and Replies” checkbox in the Twilio Settings, and we will automatically create a webhook that will listen for incoming SMS and WhatsApp messages received by your Twilio Number or Messaging Service.
As with sending, if provided, the Messaging Service will take precedence over the Twilio Number and we will listen for incoming messages on the Messaging Service. If not provided, we will listen for incoming messages on the Twilio Number.
Please note that if you are NOT using a Messaging Service and wish to receive WhatsApp messages, you will need to manually configure your WhatsApp Sender in the Twilio Console to forward incoming messages to the webhook URL shown on the Twilio Settings screen. This can be done from here.
Also, please note that if you are sending SMS messages from an Alphanumeric Sender ID, your recipients will not be able to send replies, as Alphanumeric Sender IDs are designed for one-way communication only.