Sync the data
you want with the
system you know


Automating Contact Merging in HubSpot CRM Using Custom Coding

Our client, Complex Manual Secrecy, a mid-sized company using HubSpot CRM, faced challenges with duplicate contacts. These led to outdated information and increased costs to maintain their HubSpot dashboard. To address this, we developed a custom-coded workflow to automate merging duplicate contacts, ensuring data integrity and operational efficiency.

Client Background

Our clients, also a HubSpot partner in the B2B sector, managed customer interactions, sales, and marketing campaigns all in HubSpot. With the increasing database, they encountered issues with duplicate contacts, which led to:

  • Inconsistent customer information
  • Increased CRM costs due to duplicate entries
  • The manual effort required to identify and merge duplicates

Integration Summary

The primary objectives of our solution were:

  1. Merging duplicate contacts to maintain a single contact entry with correct and updated information.
  2. Reducing the number of contacts in the CRM to avoid unnecessary charges.
  3. Eliminating manual efforts in data management to allow the team to focus on more productive tasks.


Custom-Coded Workflow

We developed a custom workflow in HubSpot with the following key features:

Identifying Duplicates

The workflow first identified contacts with identical first and last names.

It then checked the email addresses associated with these contacts. If one email was valid and the other was null, the contact with the valid email was prioritized. The contact with null email is merged with the one with valid email.

Merging Contacts Based on Last Activity

The workflow compared the last activity dates of the duplicate contacts. The contact with the latest activity was retained, and the other was merged.

Similarly, if one contact had a valid phone number and the other did not, the contact with the valid phone number was prioritized.

Company Association

Associated Company Check: An additional condition was included to ensure that the duplicate contacts were associated with the same company before merging.

Implementation Steps

  1. Compuatan integration experts extracted contact data from HubSpot to identify potential duplicates.
  2. Our integration experts developed the custom workflow using HubSpot's API to automate the merging process.
  3. They conducted thorough testing to ensure the workflow accurately identified and merged duplicates without data loss.
  4. Also, they implemented the workflow in the client's HubSpot environment and monitored initial performance.


The implementation of the custom-coded workflow led to significant improvements. The client's CRM now maintains accurate and up-to-date contact information. The client avoided additional charges by reducing duplicate contacts and optimizing their CRM expenses. Automating the merging process saved time, allowing the team to focus on strategic initiatives rather than manual data management.

Computan team members who worked on the project

Integration Expert: Tameem Ahmad


Which platforms can I integrate with HubSpot?+
Can I customize the integration to suit my business needs?+
Is there a limit to the number of integrations I can set up with HubSpot?+