# Install Salesforce chat

> Create a Whatsable API key, install the WhatsAble Chat package, paste the key into the external credential, assign the Whatsable User permission set, and add the chat to Lead, Contact, and Opportunity pages.

This page takes you from nothing to a working chat on a record. It covers the API key, the install, the permissions, and the record page.

Two kinds of person do the work. An owner or an Admin of the Whatsable organization creates the API key. A Salesforce admin installs the package, pastes the key, assigns the permission set, and edits the record page. If you are both, do the steps in order.

## Which plan can use it

Salesforce does not check your Whatsable plan when you install the package. The chat only works when your **Whatsable** organization is on a plan that includes integrations. Installing on any other plan gives you a package that shows an error.

| Whatsable plan | Can use the Salesforce chat |
|---|---|
| **Trial** (14 days from the first connected number, no card) | Yes |
| **Pro** | Yes |
| **Agency** | Yes |
| **Growth** | No |
| **Work** | No |
| **Bulk Message** | No |
| **Free**, after the trial ends | No |

Integrations are on Pro and Agency, and during the trial. Work and Growth do not include them. On a plan without integrations, the **Integrations → Salesforce** page in Whatsable shows a lock, and the API key cannot open a chat. An owner chooses a plan in [**Settings → Billing**](https://console.whatsable.app/settings/billing).

## Create the API key

The chat acts through a Whatsable API key. The key decides which WhatsApp numbers the chat can read and send from.

Only an owner or an Admin of the Whatsable organization can create a key. A Member cannot open the **API keys** page. See [API keys](/features/api-keys) for the full page.

**Open API keys**

In Whatsable, go to **API keys** in the sidebar and select **Create API key**.

**Name the key**

Enter a **Key name**, such as "Salesforce chat".

**Choose the numbers**

Choose the **Number** the key uses. To let the chat use more numbers, open **Advanced** and choose **All numbers** or **Specific numbers**. The chat lists only these numbers.

**Choose what the key can do**

Under **What this key can do**, choose **Send and read** or **Full access**. Or choose **Custom** and turn on both **Send messages** and **Read messages**.

**Create and copy**

Select **Create key**, then **Copy key**. You can reveal the key again later from the **API keys** page.

> [!WARNING]
>
> The chat needs both permissions. A **Read only** key cannot open the chat, and a key that cannot read messages is refused with the message that the **messages:read** scope is missing. Anyone with the key can message your contacts, so keep it out of email and chat.

| Key setting | What it does in the chat |
|---|---|
| **Send messages** and **Read messages** | Required. Without both, the chat does not open |
| **Number** or **Specific numbers** | The WhatsApp numbers the salesperson can pick from |
| **All numbers** | Every connected number, including numbers you add later |

## Install the package

The package is **WhatsAble Chat**. Installing it needs a Salesforce admin.

**Open the install page**

In Whatsable, open [**Integrations → Salesforce**](https://console.whatsable.app/integrations/salesforce) and click **Install in Salesforce**. Or open the [install link](https://login.salesforce.com/packaging/installPackage.apexp?p0=04tjV000000Dm8TQAS) directly.

**Sign in to the right org**

Sign in to your Salesforce org. A sandbox or Developer Edition org can install it too. Use [test.salesforce.com](https://test.salesforce.com) for a sandbox.

**Select Install for Admins Only**

On the install screen, choose **Install for Admins Only**. Do not choose **Install for All Users**. Admins Only keeps the package's setup pages and the stored key away from everyone else. People who should see the chat get access afterwards, through the **Whatsable User** permission set in [Give people access](#give-people-access).

**Finish the install**

Approve the install. Salesforce shows when it is done.

A new version of the package installs from its own link on the same Whatsable page. Installing it over the old one upgrades the org, and the key you pasted stays.

## Set the API key in Named Credentials

The package ships an **external credential** called **Whatsable** with one **principal**, **WhatsableKey**. You add the API key to that principal as one parameter, named `apiKey`. Salesforce encrypts it and does not call Whatsable at that moment.

Do this as a Salesforce admin who can edit external credentials. Because you installed for admins only, nobody else can see or change the key.

**Open Named Credentials**

In Salesforce, click the gear icon, then **Setup**. In **Quick Find**, type **Named Credentials** and open it. You land on the **Named Credentials** tab.

**Open the External Credentials tab**

Click the **External Credentials** tab, next to **Named Credentials**. The list shows **Whatsable**.

**Open the Whatsable credential**

Click **Whatsable**. The page shows its **Authentication Protocol**, which is **Custom**, and a **Principals** list with one row: **WhatsableKey**.

**Edit the WhatsableKey principal**

On the **WhatsableKey** row, click the arrow at the end of the row, then **Edit**.

**Add the apiKey parameter**

Under **Authentication Parameters**, click **Add**. Fill in:

| Field | Value |
|---|---|
| **Parameter Name** | `apiKey` |
| **Value** | The Whatsable API key you copied |

Spell `apiKey` exactly as written, with a capital **K**. The header that calls Whatsable reads the parameter by this name.

**Save**

Click **Save**. The principal now lists an `apiKey` parameter, and the value is hidden. That is expected. Salesforce never shows a saved key again.

> [!NOTE]
>
> The package already holds the rest, so you create nothing else. The Named Credential **Whatsable API** points at the Whatsable API. The **Authorization** header is built from your `apiKey` parameter. The trusted site that lets Salesforce show the chat is installed too. The principal name **WhatsableKey** and the external credential name **Whatsable** must keep their spelling.

To use a different key later, repeat steps 1 to 5 and replace the value. See [Change or stop the key later](#change-or-stop-the-key-later).

## Give people access

Two things control who can use the chat.

1. **The permission set.** The **Whatsable User** permission set lets a person use the stored key and open the chat. It holds access to the external credential principal and to the package's Apex class. A Salesforce admin does not get it automatically, so assign it to yourself too.
2. **Their Salesforce record access.** The chat reads the phone from the record as that person. They must be able to see the phone fields of the object. For a Lead or Contact, that is **Mobile Phone** and **Phone**. For an Opportunity, it is the contact roles, the contacts' phones, and the account phone.

### Check the Whatsable User permission set

**Open Permission Sets**

In **Setup**, type **Permission Sets** in **Quick Find** and open it. The list shows **Whatsable User**. Click it.

**Check external credential access**

In the **Apps** section, click **External Credential Principal Access**. **Whatsable - WhatsableKey** must be in the enabled list. If it is not, click **Edit**, move it to the enabled side, and click **Save**.

**Check Apex class access**

Go back to the permission set. Under **Apps**, click **Apex Class Access**. `WhatsableChatController` must be enabled. If it is not, click **Edit**, move it to the enabled side, and click **Save**.

The package sets both for you. Check them only when the chat shows a permission error.

### Assign it to the admin and to everyone who opens records

**Open Manage Assignments**

On the **Whatsable User** page, click **Manage Assignments**.

**Add the people**

Click **Add Assignment**. Tick your own name, the admin, and each person who should see the chat. Click **Next**.

**Leave the expiration empty**

If Salesforce shows **Manage Assignment Expiration**, leave the date empty. A date makes the access end on that day.

**Assign**

Click **Assign**, then **Done**. The **Current Assignments** list shows each person.

A person without the permission set sees an error in place of the chat. See [Limits and errors](/integration/salesforce/reference#what-the-window-shows-when-something-is-wrong).

> [!TIP]
>
> To give it to a team at once, add **Whatsable User** to a permission set group you already use, and assign the group.

## Add the chat to a record page

Do this once for each of Lead, Contact, and Opportunity.

**Open a record page**

Open a Lead, Contact, or Opportunity. Click the gear icon, then **Edit Page**, to open Lightning App Builder.

**Add the component**

From the component list, drag **WhatsAble chat** onto the page. The right sidebar, which App Builder calls **Small**, is a good place for it.

**Set the size, if you want**

Select the component. Set **Height**, a whole number from 320 to 1200, and **Width**, a whole number from 240 to 1200. The default height is 600 pixels. An empty width fills the column.

**Save and activate**

Click **Save**, then **Activate**, and choose who sees the page. Pages that do not have the component show no chat.

The component works on Lead, Contact, and Opportunity pages only. It does not appear in the component list for an Account, a Case, or the Home page.

## Check that it works

**Open a record with a phone number**

As a user with the **Whatsable User** permission set, open a Lead, Contact, or Opportunity that has a phone number in the right field.

**Read the window**

The chat shows the newest conversation with that phone on a WhatsApp number the key can use. A phone that never wrote to you shows "No messages with this number yet."

**Send a test**

Reply, or send an approved template, and check that the message reaches the phone.

**If it does not work**

Read the message in the window, then find it on [Limits and errors](/integration/salesforce/reference).

## Change or stop the key later

| You want to | Do this | What happens in Salesforce |
|---|---|---|
| Use a different key | Edit the `apiKey` parameter on the **WhatsableKey** principal and paste the new key | The chat uses the new key and its numbers the next time a record is opened |
| Replace a leaked key | In Whatsable, **Roll** the key, then paste the new one | The chat stops working until the new key is pasted |
| Change the numbers the chat can use | In Whatsable, edit the key's numbers | The new list shows after a record is opened again |
| Stop the chat for good | In Whatsable, **Revoke** the key | The chat shows an error. See [Uninstall](/integration/salesforce/uninstall) |