# App Installation and Setup

https://www.youtube.com/watch?v=-AS4EMCv\_cU

## How to get the app

Start your [free trial of Twilio for Salesforce](https://pages.twilio.com/salesforce). The trial package includes 30 free seats for 30 days.

* **Need a volume discount?** [Contact sales for more information](https://www.twilio.com/en-us/help/sales).
* **Not sure how many users you need for your project?** See "[How many licenses do I need?](/docs/salesforce/faq#how-many-licenses-do-i-need)" in the FAQ.

## Twilio for Salesforce prerequisites

* A Twilio account —[sign up here](https://www.twilio.com/try-twilio) if you don't have one yet. If you're installing Twilio for Salesforce in multiple environments, we recommend creating separate [Twilio projects](https://help.twilio.com/hc/en-us/articles/360011132374-Getting-Started-with-Twilio-Projects-and-Subaccounts) for each organization.
* Administrative access to a Salesforce with a supported edition: Enterprise, Unlimited, Force.com, Developer, or Performance.
* [MyDomain](https://help.salesforce.com/articleView?id=domain_name_overview.htm\&type=5) 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](https://pages.twilio.com/salesforce-ty). When prompted, select **Install for All Users** :

![Twilio for Salesforce package details with Add Users button highlighted.](https://docs-resources.prod.twilio.com/d309ec58803ff3f98ad589bc0e5d9108b8fc567135317cad0970057fadfdd92c.png)

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

![Get Twilio Configuration from the Salesforce App Launcher.](https://docs-resources.prod.twilio.com/2ced83657847fb0876c92e2322a5d75a2452cec171f6b3dec8fb8c0c778a2376.png)

> \[!WARNING]
>
> Twilio is only able to provide support for the **latest** version of the
> application. Because this product is in Beta, support is limited to the latest
> version of the product. To view the current app version, please visit [Twilio
> for Salesforce Changelog](/docs/salesforce/changelog).

### 2. Obtain your Twilio Account SID and Auth Token

1. From the **Twilio Configuration** page in Salesforce, click on the **Create Account** or **Log In** buttons to go to the Twilio Console.
2. You'll be asked to log in — this will take you to your Account dashboard. Scroll down to the **Account Info** section.
3. Copy the **Account SID** and **Auth Token** values from the front page of the Console:

   ![Twilio account info with SID, auth token, and phone number details.](https://docs-resources.prod.twilio.com/822ec83289c7bb6288d8526a7bb7827cd6ccb9c22f9649c8387cc1a2376264b4.png)
4. Back in Salesforce, paste your Account SID and Auth Token into Salesforce, then click on **Validate Credentials** :

   ![Twilio connect panel with fields for Account SID and Auth Token.](https://docs-resources.prod.twilio.com/80497cefcad59192efcb6e28c09cc7c874fcef8105b3cc0403930f7905a152c6.png)
5. You'll see a confirmation message like this:

   ![Twilio account connection confirmed with account SID and auth token.](https://docs-resources.prod.twilio.com/f35b12921a29ee8d825e92288b1d776ca0d5ae164b1657bca434bf5e64652f80.png)

> \[!NOTE]
>
> If you need to configure Twilio with multiple Salesforce instances or
> environments, we recommend creating a separate [Twilio
> Account](https://help.twilio.com/hc/en-us/articles/360011132374-Getting-Started-with-Twilio-Projects-and-Subaccounts)
> 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 contain 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 messaging service:

## Twilio console

1. Go to [Products & services > Messaing > Services](https://1console.twilio.com/go?to=account/__account__/us1/messaging/messaging-services).
2. Click **Create a Messaging Service**.
3. Enter a name for your messaging service and select a use case.
4. Click **Create**.

## Legacy console

1. Open the [Messaging Services page in the Twilio Console](https://www.twilio.com/console/sms/services).
2. Click **Create new Messaging Service**.
3. 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 already have phone numbers ready and a TwiML Bin that will manage the webhook that you'll use 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

To add a phone number to your messaging service:

## Twilio console

1. Sign in to the Console, navigate to **Products & Services > Numbers & Senders** and click the **Phone Numbers** tab.
2. Click **Set up a new phone number**.
3. Complete the fields on the **Basic information** page.
4. Click **Next**.
5. Select and buy a phone number on the **Select number** page.
   1. (Optional) Apply filters to limit results and click **Search**.
   2. Click **Select** next to the number, then click **Next**.
   3. On the **Review and buy number** page, review your selection and click **Purchase**.
6. Return to [Products & services > Messaing > Services](https://1console.twilio.com/go?to=account/__account__/us1/messaging/messaging-services) and select your new messaging service.
7. On the Senders tab, click **Add Senders**.
8. Select *Phone number* from the list of sender types, then select the phone number you just purchased.
9. Click **Add senders**.

## Legacy console

1. 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.
2. Use the phone numbers interface to search for a number and then click on **Buy** to purchase it.
3. 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.
4. Click the **Add Senders** button.
5. In the **Add Senders** panel, make sure the **Sender Type** is **Phone Number** and click **Continue**.
6. Now select the number you just bought, and click the **Add Phone Number** button.

### 5. 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** :

![Connect to Salesforce and validate.](https://docs-resources.prod.twilio.com/9f01496d96f38a3aa24ed54803d533cc85292a355a2055be505e8e63844dc498.png)

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:

![Twilio Configuration page showing account connection and license purchase options.](https://docs-resources.prod.twilio.com/76c2a5cf364bdddcfd208d0d4cd6fd1930957535e7dffe39cd3bd1addb16b774.png)

### 6. 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:

![Lightning App Builder showing Twilio Two Way Messages component added to Contact Record Page.](https://docs-resources.prod.twilio.com/de4beeffaa926d0c632ba65352f21f74e6801854485153f4c1407645fc9a9d0a.png)

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

> \[!NOTE]
>
> When you've completed this guide, you might like to check out our guides to these Lightning components:
>
> * [The 1:1 SMS Component](/docs/salesforce/one-one-sms-messaging-contacts)
> * [The SMS Inbox Component](/docs/salesforce/sms-inbox)
> * [The SMS Campaign Component](/docs/salesforce/sending-bulk-sms-messages-campaign-members)

### 7. 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:

1. Go to **Setup** then search for `Permission Sets` in the find field, then click on the permission set you'd like to provision:

   ![Salesforce Permission Sets page showing user assignment options.](https://docs-resources.prod.twilio.com/4a4751d1eed2eea1198e17986b8ff94890e545cb0f209e70c1e41c44e31beeaa.png)
2. On the **Permission Set** page, click on **Manage Assignments** :

   ![Salesforce setup page showing Twilio Administrator permission set with Manage Assignments highlighted.](https://docs-resources.prod.twilio.com/46132faae36dc5ebf6ac7a9e311fca5443986368b5f5131dc6473bacf0ab7870.png)
3. Click on the user you would like to assign to the permission set:

   ![Select a user.](https://docs-resources.prod.twilio.com/b7632e8016e2859a441069a1ba449a0554eafc74d5762d945fbee1ffdf32560b.png)

If you're in a sandbox environment, you don't need to do anything further — [you can jump ahead past the next step](#next-steps-with-twilio-and-salesforce). 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 sandbox user, jump to the next step.

### 8. Production only: add users to licenses

In production instances of Salesforce, you'll need to provision your users with licenses. The [trial package](https://pages.twilio.com/salesforce) includes 30 free seats for 30 days. For more pricing options, [contact sales](https://www.twilio.com/en-us/help/sales).

1. You can do this by going to **Twilio App in Salesforce > Twilio Configuration > Purchase Licenses** and then clicking on **Configure Licenses** :

   ![License configuration with active status, cost per seat $15, monthly cost $45, and configure licenses button.](https://docs-resources.prod.twilio.com/c4ddb428646833a92fe1eb0e8b97e99e4a5a2f859666ad45d39a807b6fe08b91.png)
2. Click on **Add Users** , and then select the users who you would like to have access to the package:

   ![Add Users.](https://docs-resources.prod.twilio.com/04e47eb14a7fa19889991b854366dd9d5d525f96a3f071753e1d2ffb0ed1cdc3.png)
3. You do not need to provision every user in your organization, only those who will be using Twilio functionality:

![Select users for Twilio Salesforce package, with Jacob Talbot highlighted and added.](https://docs-resources.prod.twilio.com/1bd24ae7c94ff19d649a002d1233a92b1b227c07d4ab366f9d563c4aef67edf9.png)

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](/docs/salesforce/sending-sms-messages-process-builder).
* [Send bulk SMS messages to campaign members](/docs/salesforce/sending-bulk-sms-messages-campaign-members).
* [Message contacts one on one from their Salesforce record page](/docs/salesforce/one-one-sms-messaging-contacts).
