# How to sync Salesforce & Hubspot to deduplicate records

## How to Sync Delpha Duplicate Merges with HubSpot

After merging records in Salesforce using **Delpha Duplicate**, you might still have references to the old (merged) records in external systems like **HubSpot**. These outdated references can lead to inconsistencies across your stack.

To maintain data integrity, this guide explains how to synchronize merged record updates between **Salesforce and HubSpot**.

## Overview of Required Steps

### **In HubSpot:**

1. Set up the Salesforce-HubSpot sync and map fields between platforms.
2. Create a **Private App** in HubSpot to securely connect with Salesforce.

### **In Salesforce:**

1. Add your HubSpot **Access Token** in custom metadata.
2. Enable HubSpot-specific merge tracking in **Delpha Duplicate settings**.

## HubSpot Configuration

### 1. Enable Salesforce Sync in HubSpot

* Go to **Account Setup → Integration → Connected Apps**
* From the **Action dropdown**, click **Settings**

![Hubspot Setup](https://help.delpha.io/servlet/rtaImage?eid=ka0EY000000097p\&feoid=00N5w00000NsgBL\&refid=0EMEY000000RVwF)

* Navigate to Contact / **Contact Sync Rules** and ensure **Salesforce ↔ HubSpot sync** is activated.

### 2. Set Field Mapping Between Salesforce and HubSpot

* Go to Contact / **Contact Property Mappings** in the Connected App section.
* Add new mappings to ensure fields like `Hubspot Merged Ids` are properly linked to Salesforce objects.

| **Hubspot Property**                         | **Salesforce Field**                                       | **Sync Rule** | **Status** | **Mapping Type** |
| -------------------------------------------- | ---------------------------------------------------------- | ------------- | ---------- | ---------------- |
| <p> Record ID<br> (hs\_object\_id)      </p> | <p> DDQ Hubspot Id<br> (delpha\_\_DDQ\_HubspotId\_\_c)</p> | Two-way       | Warning    | Custom           |

### 3. Create a HubSpot Private App

* Go to **Account Setup → Private Apps**
* Click **Create Private App**
  * Name it: **Salesforce Merge**
* Click **View Access Token** and copy the generated token.

<figure><img src="/files/VQ0sstjNgnvjzf3QE4FZ" alt=""><figcaption><p>Hubspot Setup</p></figcaption></figure>

## Salesforce Configuration

### 1. Add the HubSpot Access Token to Custom Metadata

* Go to **Setup → Custom Metadata Types**
* Locate **Hubspot Settings** and click **Manage Records**
* Click **Edit**, then paste your **Access Token**

![Custom Metadata Type](https://help.delpha.io/servlet/rtaImage?eid=ka0EY000000097p\&feoid=00N5w00000NsgBL\&refid=0EMEY000000RVwe)

### 2. Enable HubSpot Merged IDs in Delpha

* Open the **Delpha Setup app**
* Navigate to **Duplicate Settings → Contact**
* In the **Merge Field Rules section**, activate the setting:\
  ✅ **Hubspot Merged Ids**
* Repeat the process for the **Lead** object.

<figure><img src="/files/npASbQaqRhF9Vap1CbrF" alt=""><figcaption></figcaption></figure>

## Result

With this configuration:

* Merged Contact/Lead IDs in Salesforce will sync to HubSpot.
* HubSpot will reference the **new master record** instead of the obsolete merged one.
* Your stack stays aligned, reducing the risk of segmentation or tracking errors.

## Summary

| Platform       | Action                                                             |
| -------------- | ------------------------------------------------------------------ |
| **HubSpot**    | Enable sync, configure field mapping, create Private App           |
| **Salesforce** | Store access token in metadata, update Delpha settings for HubSpot |


---

# Agent Instructions: 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:

```
GET https://help.delpha.io/delpha-for-salesforce/how-to-faq/delpha-duplicate/how-to-sync-salesforce-and-hubspot-to-deduplicate-records.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
