APIs & Integrations

somdutt
Participant

Automating parent child relationship

SOLVE

Is there any functionality where we can trigger flow to assign parent/child company to an company automatically based upon a property change of company/contact ?

1 Accepted solution
WendyGoh
Solution
HubSpot Employee
HubSpot Employee

Automating parent child relationship

SOLVE

Hey @somdutt,

 

If you're looking for an endpoint to manage parent <--> child company relationship using HubSpot API, you can check out this documentation - CRM Associations API Overview.

 

The CRM Associations API is being updated to support two new association types:

- Parent company to child company, definition ID = 13
- Child company to parent company,definition ID = 14

 

For your use case, I'd recommend for you to use HubSpot's Webhooks API > Subscribe to contact.propertyChange and company.propertyChange > When your server received notifications > Use the Associate CRM objects endpoint to create the parent <--> child company relationship. 

View solution in original post

5 Replies 5
RBozeman
Participant

Automating parent child relationship

SOLVE

Hi @somdutt,

As far as I know you either have to use the API or potentially custom code something for this in Operations Hub. 

 

It's important to keep in mind that you'll need some way to identify parent companies within the data itself. For example, a common way of doing this is to append "HQ" onto the parent company's name. So, "HubSpot HQ," for example. And the child companies are associated to that parent company. 

 

Also wanted to mention that Insycle can do this. For full disclosure, I work there as a product marketer. But Insycle allows you to automate associations (even in workflows) between child and parent companies, using any field in your database as a matching field. It can also manage multiple associations and association labels in bulk as well. 

 

Best,

Ryan

 

Fatedx
Member

Automating parent child relationship

SOLVE

The HubSpot API v3 was released into general availability on March 31st, 2020 (just 2 months after the solution was posted here). For anyone using v3 of the API:

You can get a list of valid associations for company-to-company objects in Node like this:

 

const hubspot = require('@hubspot/api-client');
const hubspotClient = new hubspot.Client({ apiKey: 'YOUR_HUBSPOT_API_KEY ' });

hubspotClient.crm.associations.typesApi
  .getAll('companies', 'companies')
  .then(({ body }) => {
    console.log(JSON.stringify(data.body, null, 2));
  });


The response lets us know that the following 2 associationTypes exist: parent_to_child_company and child_to_parent_company. With this, we can create a child-to-parent association like so:

 

const hubspot = require('@hubspot/api-client');
const hubspotClient = new hubspot.Client({ apiKey: 'YOUR_HUBSPOT_API_KEY ' });

const childCompanyId = 'YOUR_HUBSPOT_CHILD_COMPANY_ID';
const parentCompanyId = 'YOUR_HUBSPOT_PARENT_COMPANY_ID';
hubspotClient.crm.companies.associationsApi.create(
  childCompanyId,
  'companies',
  parentCompanyId,
  'child_to_parent_company',
);

And for a parent-to-child association, simply switch the order of Id parameters and change the last parameter to 'parent_to_child_company'.

0 Upvotes
MatthewBoyd
Contributor | Elite Partner
Contributor | Elite Partner

Automating parent child relationship

SOLVE

Hi there, 

 

If this is still something you are looking for, @Dave_ at Integration Fox has built a tool for us that does this really well and is able to recreate it for others incredibly affordably.

 

Based on setting a Parent Company ID property either manually or via an import, Integration Fox automatically creates a Parent/Child relationship with the matching Company. 

 

Easy!

0 Upvotes
WendyGoh
Solution
HubSpot Employee
HubSpot Employee

Automating parent child relationship

SOLVE

Hey @somdutt,

 

If you're looking for an endpoint to manage parent <--> child company relationship using HubSpot API, you can check out this documentation - CRM Associations API Overview.

 

The CRM Associations API is being updated to support two new association types:

- Parent company to child company, definition ID = 13
- Child company to parent company,definition ID = 14

 

For your use case, I'd recommend for you to use HubSpot's Webhooks API > Subscribe to contact.propertyChange and company.propertyChange > When your server received notifications > Use the Associate CRM objects endpoint to create the parent <--> child company relationship. 

Willson
HubSpot Employee
HubSpot Employee

Automating parent child relationship

SOLVE

Hi @somdutt 

 

There isn’t currently an endpoint to automate the process of assigning Parent/Child companies. This is still currently a manual process that must be done via the User Interface. 

 

I’m not aware of plans to implement such an API, but I’d be happy to pass this idea along internally.

 

I’d also recommend posting this to the Ideas Forum on the HubSpot Community.

 

Product Manager @ HubSpot
0 Upvotes