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

# Sync Salesforce or HubSpot with Retell AI

> Connect Salesforce or HubSpot to Retell AI to sync contacts, map post-call analysis fields, and log call and chat activity automatically.

Retell's CRM integration provides a bidirectional sync between your CRM and Retell. Import contacts, enrich them with post-call analysis data, and push conversation activity back to your CRM — all automatically.

## Supported CRM Platforms

<CardGroup cols={2}>
  <Card title="Salesforce" icon="salesforce" href="/integrations/salesforce">
    Sync contacts and log call/chat activity as Salesforce Tasks.
  </Card>

  <Card title="HubSpot" icon="hubspot" href="/integrations/hubspot">
    Sync contacts and log call/chat activity to the HubSpot timeline.
  </Card>
</CardGroup>

<iframe className="w-full aspect-video rounded-xl" src="https://www.youtube.com/embed/nE6y7xrPKZk" title="Connect Hubspot with Retell built-in CRM" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen />

## How It Works

The CRM integration centers around four core capabilities:

### 1. Contact Sync (CRM to Retell)

Retell automatically imports contacts from your CRM and keeps them in sync.

* **Phone number** is the primary key used to match contacts between systems
* You configure **inbound sync mappings** to control which CRM fields map to Retell contact fields
* Default contact fields include `phone_number`, `first_name`, `last_name`, and `do_not_call`
* You can create **custom fields** (string, number, boolean, date, datetime, enum) to capture additional data from your CRM

### 2. Post-Call Analysis Mapping (Retell to Contacts)

After each call or chat completes, Retell can automatically map [post-call analysis](/features/post-call-analysis-overview) results to contact fields. This builds a rich profile over time as your agents have more conversations.

Each mapping supports three update modes:

| Update Mode       | Behavior                                                                  |
| ----------------- | ------------------------------------------------------------------------- |
| **Overwrite**     | Always replace the existing value with the new analysis result            |
| **Fill if empty** | Only update the field if it currently has no value                        |
| **Merge**         | Intelligently combine the existing and new values using LLM (0.005/merge) |

See [CRM Data Mappings](/integrations/crm-mappings) for a detailed explanation of the data flow.

### 3. Conversation Activity Logging (Retell to CRM)

When enabled, Retell logs each call and chat as an activity in your CRM:

* **Salesforce**: Creates Task records with call duration, direction, and summary
* **HubSpot**: Creates Call or Communication objects on the contact's activity timeline

Activity logging includes call metadata (direction, duration, phone numbers) and the conversation summary.

### 4. Outbound Field Sync (Retell to CRM)

You can configure **outbound sync mappings** to push contact field updates from Retell back to your CRM. When a contact's fields are updated in Retell (either manually or via analysis data mappings), the mapped fields are synced to the corresponding CRM record.

## Setting Up a CRM Integration

<Steps>
  <Step title="Connect your CRM">
    Navigate to the **Integrations** section in the Retell Dashboard and select your CRM provider. Follow the provider-specific setup guide:

    * [Salesforce setup guide](/integrations/salesforce)
    * [HubSpot setup guide](/integrations/hubspot)
  </Step>

  <Step title="Configure field mappings">
    Set up inbound sync mappings (CRM to Retell) and outbound sync mappings (Retell to CRM). The **phone number** field is statically mapped in the CRM.
  </Step>

  <Step title="Create custom fields">
    If your CRM has fields that don't map to Retell's default contact fields, create custom fields in Retell to hold that data.
  </Step>

  <Step title="Set up analysis data mappings (optional)">
    Map your [post-call/chat analysis fields](/features/post-call-analysis-overview) to contact fields. Choose the appropriate update mode for each mapping based on how you want data to accumulate over time.

    Analysis data mappings are configured at the **organization level**, not per agent. This means the same mapping rules apply regardless of which agent handled the conversation. As long as the agent's post-call analysis produces a field with the mapped name, the value will be written to the contact.
  </Step>

  <Step title="Enable conversation activity logging (optional)">
    Turn on activity sync to log each call and chat to your CRM. This creates activity records associated with the matched contact.
  </Step>

  <Step title="Run initial sync">
    Trigger a manual sync to import your existing CRM contacts. Subsequent syncs run automatically every 5 minutes.
  </Step>
</Steps>

## Contact Fields

Every Retell contact has four built-in fields:

| Field          | Type    | Description                                                                                      |
| -------------- | ------- | ------------------------------------------------------------------------------------------------ |
| `phone_number` | string  | Primary identifier for matching contacts across systems                                          |
| `first_name`   | string  | Contact's first name                                                                             |
| `last_name`    | string  | Contact's last name                                                                              |
| `do_not_call`  | boolean | This does **NOT** prevent outbound calls to this contact; it is only used for filtering purposes |

You can extend contacts with **custom fields** of the following types: `string`, `number`, `boolean`, `date`, `datetime`, and `enum`.

## Using Contact Data in Agents

Contact fields are automatically available as **dynamic variables** in your agent prompts. When a call connects to a known contact (matched by phone number), all mapped contact fields are injected into the agent's context. This lets your agent personalize conversations using CRM data like the contact's name, account status, or previous interaction history.

See [Dynamic Variables](/build/dynamic-variables) to learn how to reference contact fields in your agent prompt.
