> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apten.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Salesforce

> Integrate Apten with Salesforce.

## Overview

Connect your Apten account with Salesforce to sync information about leads and SMS conversations in Apten with any Salesforce object. Currently, we support syncing:

* **Tags**: sync tags into a field in Salesforce.
* **Summaries**: sync lead conversation summaries into a field in Salesforce.
* **Variables**: map variables to fields in Salesforce, which will sync in real-time.
* **Do not contact**: sync a lead's do-not-contact status to a boolean field in Salesforce.

Salesforce syncing works with AI conversations over SMS, voice, and email.

## Step 1: Create an Integration User in Salesforce

1. Log in to Salesforce as an administrator

2. Navigate to Setup > Users > New User

3. Fill in the required fields:

   * First Name: Apten
   * Last Name: Integration
   * Email: \[email for the integration user]
   * Username: \[unique username for integration]
   * Role: \[assign an appropriate role]
   * User License: Salesforce Integration
   * Profile: Salesforce API Only System Integrations

4. Click "Save" to create the Integration User

## Step 2: Create a Permission Set in Salesforce

1. Navigate to Setup > Permission Sets > New

2. Create a new Permission Set:

   * Label: Apten Integration Permissions
   * API Name: Apten\_Integration\_Permissions

3. Click "Save" to create the Permission Set

4. Configure the Permission Set:
   * Under "System Permissions", enable:
     * API Enabled
   * Under "Object Settings", enable:
     * Read, Create, and Edit permissions for the object that you want to sync with Apten (e.g., Lead, Contact, etc.).
     * Field-level Read and Edit access for every field Apten should read from or write to, including fields used for tags, summaries, variables, and do-not-contact status.
   * Apten does not require "Modify All Data" or "Customize Application" permissions.

5. Assign the Permission Set to the Integration User:
   * Go to Setup > Permission Sets
   * Click on the "Apten Integration Permissions" Permission Set
   * Click "Manage Assignments"
   * Click "Add Assignments"
   * Select the Apten Integration User
   * Click "Assign"

## Step 3: Connect Apten to Salesforce

1. In Apten, go to **Integrations**
2. Click **Connect** on the Salesforce card
3. Authorize with the email and password for the Salesforce Integration User
4. Click **Connect**
5. Select the object that you want to sync with Apten (e.g., Lead, Contact, etc.), and click **Save** (you won't be able to change this later).
6. If you'd like to sync Tags or Summaries, click the **Set up** button next to the relevant section.
   * Select the Salesforce field you want Apten to update.
   * **Important: The Integration User must have field-level access to the selected field, or syncing will fail.**

## Step 4: Map Variables (Optional)

When setting up variables in customer profiles in **Build & Test**, you can map them to Salesforce fields.

These fields will automatically sync to Salesforce in real-time when Apten talks to a lead.

<img src="https://mintcdn.com/apten/YWMBZJCBaobOmPBP/integrations/variables.png?fit=max&auto=format&n=YWMBZJCBaobOmPBP&q=85&s=03aa542f7f3f6253c74fa73751de5bdb" alt="Salesforce Variables" width="2562" height="1510" data-path="integrations/variables.png" />

## Step 5: Import Leads with Salesforce IDs

When importing leads into Apten, you must set the following fields:

* `integrationSource`: Set this to `'salesforce'` to indicate the lead is from Salesforce
* `salesforceId`: Set this to the Salesforce object ID of the lead (e.g. '00Q1a000004XYZ')

Example payload:

```json theme={null}
{
  "firstName": "John",
  "lastName": "Doe",
  "phone": "1234567890",
  "customerProfile": "Test Profile",
  "integrationSource": "salesforce", // Required for Sync
  "salesforceId": "00Q1a000004XYZ" // Required for Sync
}
```
