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.
- 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 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 see the following page:
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:
Paste your Twilio Account SID and Auth Token into Salesforce, then click on "Validate Credentials":
You should see a confirmation message:
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.
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.
Give your Messaging Service a name that makes sense for your project. For example, "Twilio for Salesforce: Production".
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.
Next, we'll add a phone number to your messaging service. In the side-navigation click on "Numbers" then click on "Buy a Number".
Use the phone numbers interface to search for a number and then click on "Buy" to purchase:
Once you've purchased your first phone number, you should see it appear in your messaging service:
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.
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:
Then, click on "Create new TwiML Bin":
Inside your new TwiML Bin, add the following TwiML snippet:
Once your TwiML Bin should looks like this, click save:
Next, you can copy the link to your TwiML Bin:
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:
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.
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":
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:
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:
Click "Save" in the top-right corner of the Lightning App Builder and then follow the instructions to deploy your layout to users.
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:
On the permission set page, click on "Manage Assignments":
Then, 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. If you're in a production organization, you'll need to configure Salesforce licenses for the users that need access.
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.
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.
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:
- Send automated SMS messages from Process Builder
- Send bulk SMS messages to campaign members
- Message contacts one on one from their Salesforce record page