Salesforce Integration with Twilio Explained.
Do you have a Use Case to notify users via SMS, WhatsApp or Voice call directly from Salesforce? This article explains how Twilio can be used to meet these requirements.
What is Twilio?
Twilio provides programmable communication tools for making and receiving phone calls, sending and receiving text messages, and performing other communication functions using its web service APIs. Twilio can be used to send SMS, WhatsApp Message, Voice, Video, Email, and even IoT, across the customer journey. All you need to do is integrate its API with your software.
Twilio Trial Org Setup
- You can get started by signing up for Twilio trial org.
- A verification email will be sent. Please verify your Email and phone number.
- A popup to activate your Sandbox will appear. Please click Confirm to proceed.
Hurray!! Your trial account has been created. Each trial account is provided a budget of $15 for experiencing the features.
- Messages can only be sent to verified caller IDs. Please check if your Phone number is included in the list of verified caller IDs.
- Click on Active numbers and Buy a Twilio Number.
- You can set up your Sandbox for WhatsApp by following the instructions provided on clicking over Send a WhatsApp message link in the sidebar
- You can create a new Messaging service. This will help in sending scheduled messages and tracking the messages sent.
Salesforce Setup for Twilio Integration
- Please add the following URL https://api.twilio.com to Remote site setting in salesforce
- We have created an unmanaged package containing the Messaging application and its components. This sample Application contains an aura component with functionalities to send WhatsApp messages, SMS and fetch the messages sent to a mobile number.
- Install the package in Developer Org – Note: Components in this sample package were just created for the demo and may not be production ready.
- After installing the package, go to the Developer Console and open Constans_dec.apxc.
- Go to the home page of your twilio account and copy the Account SID. Replace the value of account variable in Constans_dec.apxc with account sid.
- Go to the home page of your twilio account and copy the Auth Token. Replace the value of token variable in Constans_dec.apxc with Auth Token.
- Go to the home page of your twilio account and copy the My Twilio Phone Number. Replace the value of the fromnum variable in Constans_dec.apxc with Twilio Phone Number.
- Navigate to the messaging service created previously and copy its SID. Replace the value of msg_sid variable in Constans_dec.apxc with Message SID.
- Save Constans_dec.apxc.
- You can click on the App Launcher to open Messaging application
- This is an app which contains an app page containing the aura component available in the package.
- That’s it! You can now test the application.
- Click on the Monitor tab and navigate to logs in Twilio account to view the status of Messages sent.
Salesforce Integration with Twilio Considerations
- Messages can only be sent to verified caller IDs.
- For sandbox environment +14155238886 will be used in From parameter for sending WhatsApp messages.
- Only one Twilio number is allowed per trial org.
- Sandbox connectivity of a whatsapp number lasts for 3 days. Beyond which it needs to be reconnected.
- SMS sent from a free trial phone number will begin with “Sent from a Twilio trial Account”.
- You will be able to send SMS from your SMS-enabled Twilio phone number, but not from your verified personal number. This rule also applies after the trial.
- Some high cost and premium access numbers aren’t reachable by default; for help enabling messages to a desired country, please refer to Global SMS on Trial Accounts article.
Did you get a chance to experience this captivating feature? If not, get started by installing the unmanaged package and following the detailed steps provided in this article. Please let us know your thoughts in the comments!