# Salesforce

Nimbata's Salesforce integration automatically sends call data to Salesforce, so you can capture caller details and track which marketing sources drive phone leads. When a caller is not in Salesforce yet, Nimbata creates the records you choose, such as a Lead and an Event. When the caller already exists, it updates the fields you map. A workflow decides which calls are sent.

**Before you start**

- Permissions: Salesforce, under Integrations, in your Nimbata role
- A Salesforce account you can sign in to, in the environment (production or sandbox) you want calls in.
- The Nimbata project whose calls you want to send: the integration is set up per project.

## Connect Salesforce

1. (1) **Open the Salesforce integration**

   Go to **Integrations** and click **Go to integration** on the **Salesforce** tile (1), or go straight to [Integrations > Salesforce](https://app.nimbata.com/integrations/service/salesforce).

   [The Salesforce tile on the Integrations page, with Go to integration marked 1]

   *Open the Salesforce tile (1).*

2. (1) **Connect your Salesforce account**

   - Click **Connect** (1).
   - Sign in with your Salesforce credentials.
   - A confirmation message appears once connected, and the page shows whether you are on the **Production Environment** or a **Sandbox Environment**. To change it, disconnect from Salesforce first.

   [The Salesforce integration page before it is connected, with the Connect button marked 1, above the Caller not found and Caller found sections and Send Test and Save]

   *Click Connect (1) and sign in to Salesforce.*

## Configure Salesforce

Each setup, such as **Salesforce Settings 1**, has two sections: **Caller not found**, what Nimbata creates when the caller is not in Salesforce, and **Caller found**, what it updates when they are. To send different calls to Salesforce in different ways, click **Set up Salesforce** to add another setup; each workflow picks the setup it sends.

1. **Map your fields**

   - Nimbata loads all objects and fields from your Salesforce account.
   - For each scenario, **new caller** (**Caller not found**) and **existing caller** (**Caller found**), choose which Salesforce object to create or update. Click **+ Add object** to add another.
   - Map the Nimbata fields to the corresponding Salesforce fields, or click **Use Default Config** to fill in the recommended mapping.

   [The Salesforce Caller not found section: Create a Lead with Company, Last Name, Lead Source, Phone and Status mapped, and Create an Event with a Description]

   *Caller not found: a new Lead with its fields mapped, then an Event.*

2. (1) **Choose how existing callers are matched**

   In the **Caller found** section, answer the two matching questions first:

   1. **Which entity to enrich** (1), when the Caller ID is found in more than one object: **Contact**, **Lead**, **Account** or **All**.
   2. **How to handle duplicates** (2), when the same Caller ID is found more than once in one object: **Handle first**, **Handle all** or **Ignore all**.

   Then use the **Update** tab to choose the fields to update on the matched record.

   [The Salesforce Caller found section: the entity question with Contact chosen, marked 1, and the duplicates question with Handle first chosen, marked 2]

   *Choose the entity to enrich (1) and how to handle duplicates (2).*

## Test the integration

1. **Send a test event**

   - Click **Send Test and Save**, fill in the test data fields, and click **Send event**. Include a **Caller ID**: if it is already in Salesforce, Nimbata runs your **Caller found** actions, otherwise your **Caller not found** actions.
   - Check your Salesforce account to confirm the record was created or updated as expected.

2. **Save the setup**

   Click **Save**.

## Send calls with a workflow

Nimbata sends a call to Salesforce when a workflow with a **Salesforce** action runs for it. A workflow that runs when a call ends, with no filter, sends every call, and its filters (for example call outcome or tracking number) narrow it down.

1. **Create a workflow**

   Go to **Workflows**, click **Create** and choose **From Scratch**. Keep the **Inbound Call** trigger with **Call Ends**, and add any filters you need.

2. (1) **Add the Salesforce action**

   Click the **+** plus sign, select **Perform action**, and choose **Salesforce** under **Integrations**. Pick your setup under **Select configuration** (1), then click **OK**.

   [The Salesforce pop-up of the workflow builder, with the Salesforce Settings 1 setup selected and marked 1]

   *Pick the Salesforce setup to send (1), then click OK.*

3. (1) **Enable the workflow**

   Click **Enable** (1).

   [A workflow firing on Inbound Call, Call Ends, with a Salesforce action sending Salesforce Settings 1, and the Enable button marked 1]

   *The workflow sends every inbound call to Salesforce when it ends. Click Enable (1).*

Detailed guide: [Create a workflow](https://help.nimbata.com/workflows/workflows#create-a-workflow)

## Check it worked

The Salesforce page now shows the workflow that uses the integration. Place a test call to one of your tracking numbers: once it ends, the record appears in Salesforce.

[The connected Salesforce integration, used in 1 workflow, with Salesforce Settings 1 used by the Salesforce calls workflow]

*The page shows Used in 1 workflow, and the setup lists the workflow that sends it.*

🎉 Done! Nimbata sends call data to Salesforce after every call that matches your configuration.

## Troubleshooting

### The Salesforce tile says Disconnected

Nimbata has lost its connection to Salesforce. Your Salesforce settings are saved, but nothing is sent until you reconnect: open the integration and click **Reconnect** in the red **Disconnected.** banner.

[The Salesforce tile on the Integrations page with a red Disconnected badge]

*A disconnected integration shows a red Disconnected badge on its tile.*

### Records go to the wrong Salesforce environment

The environment button at the top of the page shows **Production Environment** or **Sandbox Environment**. It cannot be changed while connected: disconnect from Salesforce in the page's three-dot menu, then connect again and sign in to the other environment.

### Send Test and Save is greyed out

- Connect Salesforce first: the button stays off until the integration is connected.
- Map at least one field under **Caller not found** or **Caller found**.
- If the test answers "Please provide a valid caller id", fill in the **Caller ID** box in the test panel.

### Calls are not reaching Salesforce

- Check that a workflow with a **Salesforce** action is enabled, and that its filters let the call through.
- Check that the workflow's Salesforce action uses the setup you configured, under **Select configuration**.
- Check that the Salesforce tile does not say **Disconnected**.
- Send a test from **Send Test and Save** to see the error Salesforce returns.
