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.
- Need a volume discount? Contact sales for more information.
- Not sure how many users you need for your project? See “How many licenses do I need?” in the FAQ.
Twilio for Salesforce prerequisites
- A Twilio account — sign up here if you don’t have one yet. If you’re installing Twilio for Salesforce in multiple environments, we recommend creating separate Twilio projects for each organization.
- Administrative access to a Salesforce with a supported edition: Enterprise, Unlimited, Force.com, Developer, or Performance.
- MyDomain configured for your Salesforce instance.
Twilio for Salesforce installation takes 10-20 minutes. Let’s get started.
Install the app and configure your setup
1. 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:
Once the package has finished installing, search for Twilio Configuration
from the Salesforce App Launcher. You should then see this page:
2. 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.
- You’ll be asked to log in — this will take you to your Account dashboard. Scroll down to the Account Info section.
- Copy the Account SID and Auth Token values from the front page of the Console:
- Back in Salesforce, paste your Account SID and Auth Token into Salesforce, then click on Validate Credentials:
- You’ll see a confirmation message like this:
If you need to configure Twilio with multiple Salesforce instances or environments, we recommend creating a separate Twilio Account for each instance. Each instance will have its own Account SID and Auth Token.
3. 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.
- Click on Create new Messaging Service:
- Give your messaging service a name that makes sense for your project: for example,
Connect to Salesforce
. When you’re ready, click the blue Create Messaging Service button to establish your new messaging service:
If you alread have phone numbers ready and a TwiML Bin that will manage the webhook that will be used to relay messages to Salesforce, you can proceed through the messaging service setup wizard. For this guide, we assume that you don’t, so just click the Skip Setup button for now. We’ll work through each of these setup stages separately.
4. Add phone numbers to your messaging service
- In the Console’s left-hand sidebar, click on Explore Products, scroll to the Super Network section, click on Numbers, then on the Buy a number button.
- Use the phone numbers interface to search for a number and then click on Buy to purchase it:
- Now return to your messaging service — click on Services under Messaging in the Console’s left-hand sidebar. You’ll see your message service listed by name — click on it and then click on Sender Pool in the sidebar.
- Click the Add Senders button:
- In the Add Senders panel, make sure the Sender Type is Phone Number and click Continue:
- Now select the number you just bought, and click the Add Phone Number button:
5. Create a webhook for your messaging service
You now need to provide instructions to tell Twilio how to handle inbound messages. This step is necessary for you to see your incoming messages inside Salesforce. If this process is not configured, your incoming messages will be marked as Failed Error: 30008
and will not be synced to Salesforce.
To handle inbound requests, you create a TwiML Bin with an empty <Response />
TwiML verb and then add that TwiML Bin’s handler URL as a webhook. If you’re new to Twilio and this sounds unfamiliar, don’t worry: we’ll show you what to do.
- In the Twilio Console left-hand sidebar, click Explore Products, scroll down the Developer tools section and click on TwiML Bins.
- Click on the blue + button:
- Inside your new TwiML Bin, add the following single-line TwiML snippet to the code already there:
<Response></Response>
It will look like this:
- Click Save.
- Copy your TwiML Bin’s URL:
- Now go back to your messaging service and then click on Integration, check the Send a Webhook radio button, and paste your TwiML Bin URL into the Request URL field:
- Finally, click Save at the bottom of the page.
Your messaging service now has a URL to send messages to. This will stop you from getting false warnings when you receive an inbound message.
6. Select your messaging service in Salesforce
Return to the Twilio Configuration page in Salesforce and refresh the page. You can now be able to select your messaging service from the Select Message Service popup menu. Do so then click Validate Credentials:
Once your Twilio Account SID, Auth Token, and messaging service have been validated, you’ll see the full list of configuration options appear on the Twilio Configuration page:
7. Add Lightning components to Salesforce layouts
You can add Twilio for Salesforce’s Lightning components to your layout using Salesforce’s 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 then selecting Edit Page.
You can then use the Lightning App Builder to add components, such as Twilio’s Two-Way Messages, to the page:
Click Save in the top-right corner of the Lightning App Builder and then follow the instructions to deploy your layout to users.
When you’ve completed this guide, you might like to check out our guides to these Lightning components:
• The 1:1 SMS Component
• The SMS Inbox Component
• The SMS Campaign Component
8. 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 organization 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 find field, then click on the permission set you’d like to provision: - On the Permission Set page, click on Manage Assignments:
- Click on the user you would like to assign to the permission set:
If you’re in a sandbox environment, you don’t need to do anything further — you can jump ahead past the next step. If you’re in a production organization, however, you’ll need to configure Salesforce licenses for the users who’ll need access. We’ll show you how to do that now, but if you are a sanbox user, jump to the next step.
9. Production only: add users to licenses
In production instances of Salesforce, you’ll need to provision your users with licenses. 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.
- You can do this by going to Twilio App in Salesforce > Twilio Configuration > Purchase Licenses and then clicking on Configure Licenses:
- Click on Add Users, 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 functionality:
That’s it — you’re done!
Next steps with Twilio and Salesforce
Now that your Twilio for Salesforce install is all set, it’s time to start sending some messages.
Here are some more Twilio for Salesforce tutorials to help you make the most of your installation:
- Send automated SMS messages from Process Builder.
- Send bulk SMS messages to campaign members.
- Message contacts one on one from their Salesforce record 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 by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.