Import Contacts from HubSpot to Salesforce
Tags: integrations, hubspot, salesforce, saas
Published: 2021-12-30 16:40:32

---
title: Import Contacts from HubSpot to Salesforce
published: true
description: In this blog post, you will learn how to easily import contacts from HubSpot to Salesforce with a few clicks using Fusebit.
tags: Integrations, HubSpot, Salesforce, SaaS
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9cr1747gjvu5bbn6u1z2.png
---

In this blog post, you will learn how to easily import contacts from HubSpot to Salesforce with a few clicks using Fusebit.

**Contact in HubSpot**
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2hagvyc6e7a4uhyzub1p.png)

**Contact sync in Salesforce**
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tezmwwmt79b0av6f613j.png)

## Create HubSpot and Salesforce integration
1. [Sign up or log in to Fusebit](https://manage.fusebit.io/signup?utm_source=fusebit.io&utm_medium=referral&utm_campaign=blog-contacts-hubspot-salesforce)
2. Click on “New Integration”. Choose HubSpot Contacts sync in the middle column, and change the integration name and the HubSpot Connector name (optional). Click on Create.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t0gfcwzivdu43fwzfguq.png)
3. In the right column “Connectors”, click on `Add new`, or `Link existing` and create a Salesforce connector.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d6is0uci8dvlgxe5c172.png)
As a Salesforce and HubSpot user, you can create powerful integrations between the two systems with code.

Click on “Edit” in the middle column, and replace the code with:

```javascript
const { Integration } = require('@fusebit-int/framework');

const integration = new Integration();
const router = integration.router;

const hubspotConnector = 'hubspot';
const sfdcConnector = 'salesforce';

router.post('/api/tenant/:tenantId/sync', integration.middleware.authorizeUser('install:get'), async (ctx) => {
  const hubspotClient = await integration.tenant.getSdkByTenant(ctx, hubspotConnector, ctx.params.tenantId);
  const sfdcClient = await integration.tenant.getSdkByTenant(ctx, sfdcConnector, ctx.params.tenantId);
  const contacts = await hubspotClient.crm.contacts.getAll();
  await Promise.all(contacts.map(async (contact) => {
    const res = await sfdcClient.sobject('Contact').create({LastName: contact.properties.lastname, Email: contact.properties.email, FirstName: contact.properties.firstname})
  }))
  ctx.body = `Successfully performed initial import from hubSpot to SFDC.`;
});

integration.event.on('/:componentName/webhook/:eventtype', async (ctx) => {
    const hubspotClient = await integration.service.getSdk(ctx, hubspotConnector, ctx.req.body.installIds[0])
    const sfdcClient = await integration.service.getSdk(ctx, sfdcConnector, ctx.req.body.installIds[0]);
    const contact = await hubspotClient.crm.contacts.basicApi.getById(ctx.req.body.data.objectId);
    await sfdcClient.sobject('Contact').create({LastName: contact.properties.lastname, Email: contact.properties.email, FirstName: contact.properties.firstname})
});

module.exports = integration;
```

Keep in mind to change the constants `hubspotConnector`and `sfdcConnector` with your own connector name.

Now that you have both connectors and the integration logic let’s configure HubSpot and Salesforce.

## To Configure HubSpot Developers and Connect to Salesforce, click [here](https://fusebit.io/blog/contacts-from-hubspot-to-salesforce/)

### One Last Thing…

If you have any questions, you can [contact us](https://fusebit.io/contact/). Keep in mind that you can create any HubSpot Salesforce integration using Fusebit, filter contact activity, get contact data, advanced setup and sync data between the two platforms.

If you want to use other platforms, create powerful bi-directional sync and improve your customer experience, for example sending new Salesforce leads to your marketing team in slack, check out [Fusebit](https://fusebit.io/), and follow us on [Twitter](https://twitter.com/fusebitio)!