Skip to content

Instantly share code, notes, and snippets.

View chrisoklepke's full-sized avatar

Chriso Klepke chrisoklepke

View GitHub Profile
@chrisoklepke
chrisoklepke / associateContactToCompany.js
Last active December 29, 2022 12:14 — forked from jackcoldrick90/associateContactToCompany.js
This custom code snippet can be used to associate a contact to a company based on the company name property that is stored at a contact level. It's particularly useful if your customers are using a freemail address and aren't supplying a company website - just the name of their company. If no company is found a new record will be created in the …
// Import the Hubspot NodeJS Client Library - this will allow us to use the HubSpot APIs
const hubspot = require('@hubspot/api-client');
/*
This function is called when the custom code action is executed. It takes 2 arguements. The first is the event object which contains information on the currently enrolled object.
The second is the callback function which is used to pass data back to the workflow.
*/
exports.main = (event, callback) => {
// Instantiate a new HubSpot API client using the HAPI key (secret)