Skip to content

Salesforce Integration with Twilio Explained

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.

1. 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.

2. Twilio Trial Org Setup

  • You can get started by signing up for Twilio trial org.
Salesforce Integration with Twilio Trial Sign Up Page
  • A verification email will be sent. Please verify your Email and phone number.
Twilio Email Verification
  • A popup to activate your Sandbox will appear. Please click Confirm to proceed. 
Salesforce Integration with Twilio  Sandbox Activation

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.
Verified Caller IDs
  • Click on Active numbers and Buy a Twilio Number.
Salesforce Integration with Twilio Activate Numbers
  • You can set up your Sandbox for WhatsApp by following the instructions provided on clicking over Send a WhatsApp message link in the sidebar 
Send a WhatsApp Message
  • You can create a new Messaging service. This will help in sending scheduled messages and tracking the messages sent.
Salesforce Integration with Twilio Services

3. Salesforce Setup for Twilio Integration

  • 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.
  • 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.
Salesforce App
  • 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.
Message Status

4. 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.

5. Additional Details

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!

Written By…

Disclaimer: The views and opinions expressed in this article are solely those of the author and do not reflect the views of DineshYadav.com. DineshYadav.com does not endorse any of the Third Party Organizations or Applications mentioned in the article, including their legality, integrity, quality, accuracy or any applicable intellectual property rights.


Recommended Articles

Share this article...

Please Leave a Comment

error: Content is protected !!

Discover more from DYDC

Subscribe now to keep reading and get access to the full archive.

Continue reading