Menu

Expand
Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

App Installation and Setup

How to Get the App

Start your free trial of Twilio for Salesforce here. The trial package includes 30 free seats for 30 days. Twilio for Salesforce is priced at $15 per user per month.

Twilio for Salesforce prerequisites

  • A Twilio account - sign up here if you don’t have one yet.
  • Access to the Twilio for Salesforce – get it on the AppExchange.
  • Administrative access to a Salesforce with a supported edition: Enterprise, Unlimited, Force.com, Developer, Performance
  • MyDomain configured for your Salesforce instance

Twilio for Salesforce installation takes between 10-20 minutes. Let's get started.

Install Twilio for Salesforce From the AppExchange

Install Twilio for Salesforce using the links available on this page. When prompted, select "Install for All Users":

Salesforce installation dialog

Once the package has finished installing, search for "Twilio Configuration" from the Salesforce App Launcher. You should see the following page:

Screen Shot 2020-04-14 at 3.45.48 PM.png

Obtain your Twilio Account SID and Auth Token

From the "Twilio Configuration" page in Salesforce, click on the "Create Account" or "Log In" buttons to go to the Twilio Console. Copy the "Account SID" and "Auth Token" values from the front page of the console:

Twilio Account Dashboard

Paste your Twilio Account SID and Auth Token into Salesforce, then click on "Validate Credentials":

Twilio Config connect panel

You should see a confirmation message:

Screen Shot 2020-04-14 at 4.03.37 PM.png

Next, we'll create a messaging service (a pool of phone numbers) to be used with Twilio for Salesforce.

Tip: If you need to configure Twilio with multiple Salesforce instances or environments, we recommend creating a separate Twilio Project for each instance. Each instance will have a unique Account SID and Auth Token.

Create a Messaging Service

A Messaging Service is a pool of Twilio phone numbers that are enabled with software to prevent text encoding issues, provide international phone numbers, and scale messaging capacity. Twilio for Salesforce uses a messaging service to provide phone numbers for three types of SMS:

  • SMS sent from Salesforce users that don't have a personal phone number assigned.
  • Campaign SMS sent from the Campaigns Lightning Component.
  • Notifications sent from the "Send SMS" process builder action.

To create a mesaging service, open the Messaging Services page in the Twilio Console. Create a new Messaging Service by clicking the plus (+) button.

Create new messaging service

Give your Messaging Service a name that makes sense for your project. For example, "Twilio for Salesforce: Production".

Screen Shot 2020-04-14 at 4.14.02 PM.png

Choose the "Notifications, Two-Way" use case (or choose another based on your use-case). The use-case is for internal Twilio use only, and has no impact on applicaton behavior. When you're ready, click on the red "Create" button to create your new messaging service.

Add Phone Numbers to Your Messaging Service

Next, we'll add a phone number to your messaging service. In the side-navigation click on "Numbers" then click on "Buy a Number".

Screen Shot 2020-04-14 at 4.38.20 PM.png

Use the phone numbers interface to search for a number and then click on "Buy" to purchase:

Screen Shot 2020-04-14 at 4.39.54 PM.png

Once you've purchased your first phone number, you should see it appear in your messaging service:

Screen Shot 2020-04-14 at 4.40.18 PM.png

Now that our Messaging Service is set up with a phone number, we can return to the Twilio Configuration page to connect our messaging service to Salesforce.

Create a Webhook for Your Messaging Service

Next, we need to provide instructions for how Twilio should handle inbound messages. Twilio for Salesforce automatically syncs messages to Salesforce once a minute so setting a webhook for inbound messages is not required. However, we recommend setting a webhook anyway to prevent warnings in the Twilio debugger.

To handle inbound requests, we need to create a TwiML Bin with an empty <Response /> TwiML verb and then add that TwiML Bin's handler URL as our webhook. If you're new to Twilio and this sounds unfamiliar, not to worry; we have screenshots every step of the way. Here's the step-by-step process:

In the navigation sidebar of the Twilio Console, click TwiML Bins:

Screen Shot 2020-05-22 at 5.02.30 PM.png

Then, click on "Create new TwiML Bin":

Screen Shot 2020-05-22 at 5.02.44 PM.png

Inside your new TwiML Bin, add the following TwiML snippet:

<Response></Response>

Once your TwiML Bin should looks like this, click save:

Next, you can copy the link to your TwiML Bin:

Screen Shot 2020-05-22 at 5.04.39 PM.png

Finally, you can go back to your Messaging Service and then click on "Settings". Under "Inbound Settings" click on "Send an Incoming_Message Webhook". Then, paste your TwiML Bin URL into the request URL input and click "Save" at the bottom of the page:

Screen Shot 2020-05-22 at 5.12.19 PM.png

Great work! Your messaging service now has a URL to send messages to, which will stop you from getting false warnings when you receive an inbound message.

Select Your Messaging Service in Salesforce

Return to the "Twilio Configuration" page in Salesforce and refresh the page. You should be able to select your messaging service from the dropdown menu, then click "Validate Credentials":

Screen Shot 2020-04-14 at 4.52.00 PM.png

Once your Twilio Account SID, Auth Token, and Messaging Service have been validated, you should see the full list of configuration options appear on the Twilio Configuration page:

Screen Shot 2020-04-14 at 4.52.35 PM.png

Add Lightning Components to Salesforce Layouts

You can add Twilio for Salesforce's lightning components using the Salesforce Lightning App Builder. Open the Lightning App Builder by opening a record (Leads, Contacts, Person Accounts, Cases, or Campaigns), clicking on the configuration gear icon, and selecting "Edit Page".

You can then use the Lightning App Builder to add components to the page:

Screen Shot 2020-04-14 at 4.58.57 PM.png

Click "Save" in the top-right corner of the Lightning App Builder and then follow the instructions to deploy your layout to users.

Add users to the Twilio permission sets

The last step before using the Twilio features in your Salesforce install is to add users.

Anyone who should have access to Twilio functionality should be divided between the two new permission sets that were added to your org during installation: "Twilio User" and "Twilio Administrator". A "User" can send and view messages, and generally access all the features of the package. An "Administrator" will be able to view and configure Twilio API credentials.

To add these permission sets in Salesforce, go to "Setup" then search for "Permission Sets" in the quick find, then click on the permission set you'd like to provision:

Screen Shot 2020-04-14 at 5.07.27 PM.png

On the permission set page, click on "Manage Assignments":

Screen Shot 2020-04-14 at 5.07.45 PM.png

Then, click on the user you would like to assign to the permission set:

Screen Shot 2020-04-14 at 5.06.57 PM.png

If you're in a sandbox environment, you don't need to do anything further. If you're in a production organization, you'll need to configure Salesforce licenses for the users that need access.

Production Only: Add Users to Licenses

In production instances of Salesforce, you'll need to provision your users with licenses. You can do this by going to Setup > Apps > Installed Packages > Twilio for Salesforce. The trial package includes 30 free seats for 30 days. Twilio for Salesforce is priced at $15 per seat per month with volume discounts available. Contact sales for more information about purchase and discounts.

Screen Shot 2019-04-12 at 6.20.00 PM.png

Click on manage licenses, and then select the users who you would like to have access to the package. You do not need to provision every user in your organization, only those who will be using Twilio SMS.

Screen Shot 2019-04-12 at 6.20.49 PM.png

Next Steps with Twilio and Salesforce

Now that your Twilio for Salesforce install is all set, it's time to start sending some messages.

See more Twilio for Salesforce tutorials here:

Rate this page:

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.