> For the complete documentation index, see [llms.txt](https://docs.spara.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.spara.com/guides/integration-guides/connecting-salesforce.md).

# Connecting Salesforce

How to connect Spara to Salesforce and configure lead syncing.

This guide walks you through connecting Spara to Salesforce so that lead conversations and field data sync automatically to your CRM.

For a full feature reference, see [Salesforce](https://docs.spara.com/integrations/crm-integrations/salesforce).

## What Syncs

Once connected, Spara can:

* Write conversation data and field values to matching Salesforce Leads and Contacts (Push)
* Create new Salesforce records when no match is found
* Import existing Salesforce records into Spara as Leads (Pull)
* Read Account and Owner data to personalize agent behavior

{% stepper %}
{% step %}

#### Navigate to Integrations

Go to [**Settings > Integrations**](https://app.spara.co/settings/integrations) and find the Salesforce card. Click **Authorize**.

{% hint style="info" %}
You need Manager or Integrator permissions to connect integrations. See [User Management](https://docs.spara.com/platform/settings/user-management) for role details.
{% endhint %}
{% endstep %}

{% step %}

#### Enter your Salesforce URL and authorize

Enter your Salesforce instance URL (e.g., `https://yourcompany.salesforce.com`). Use your main Salesforce domain, not a `.force.com` URL.

Click **Authorize** and complete the Salesforce authentication flow.
{% endstep %}

{% step %}

#### Configure Push Rules

On the Manage page, use the **Contacts** and **Leads** tabs to choose a sync mode independently for each object type:

* **Create or update**: update matching Salesforce records; create new ones when no match is found
* **Update only**: update matching records, but never create new ones
* **Create only**: always create a new record, without matching to existing ones
* **Off**: do not sync to this record type

Spara matches records by Salesforce ID, email address, or phone number automatically.
{% endstep %}

{% step %}

#### Map fields

Under **Data Model Sync**, set up field mappings between Spara Lead fields and Salesforce fields. Configure mappings separately for Contacts and Leads using the tabs.

For each mapping:

1. Choose a **Spara field** (e.g., First name, Company, or any custom field)
2. Choose the corresponding **Salesforce field**
3. Set the **Write rule**: overwrite existing values, or only write when the field is empty

To sync the full conversation history, map the **Conversation** Spara field to any Salesforce text field.

For a full list of available Spara fields, go to [**Data Model**](https://app.spara.co/data-model).
{% endstep %}

{% step %}

#### Save and verify

Click **Save** to activate the connection. New lead activity will begin syncing to Salesforce immediately.

To verify, have a test lead interact with your Spara agent and confirm that a corresponding Lead or Contact record appears or is updated in Salesforce.
{% endstep %}
{% endstepper %}

## Troubleshooting

### OAuth Error

If you see an OAuth Error, have your Salesforce admin connect directly from Spara, or create an external connected app with API read/create/edit access on Leads and Contacts.

### Reconnection required

Go to [**Settings > Integrations > Salesforce**](https://app.spara.co/settings/integrations/salesforce/manage), click **Deauthorize**, then authorize again.

### Disconnecting

Click **Deauthorize** on the Salesforce manage page. Your sync configuration and field mappings are preserved for when you reconnect.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.spara.com/guides/integration-guides/connecting-salesforce.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
