APIs & Integrations

vurazov
Member

How to get engagement's associated company?

Hello!

I’m using Get all engagements API method to get latest engagements.

Let’s say I’m only interested in NOTES.
Well, I’m trying to connect them to company they are about. In resulting JSON it [associations->companyIds]. But there are cases the companyIds is empty.
Example: I have a company and a deal. If I make a note for a deal then note has no companyIds associations.

How can I get an associated company for sure?
May be I should look for different properties in different situations like: note for a company, note for a deal, note for a task?

Point me out to documentation if there is one.

Thanks in advance.

0 Upvotes
3 Replies 3
Dadams
HubSpot Employee
HubSpot Employee

How to get engagement's associated company?

Hi @vurazov

Engagements that are associated with a deal are not automatically associated with the company associated with the deal, so in those cases you’d need to look at the separate deal object to see which company the deal itself was associated with.

If you’re creating engagements through the API, you’d you’d need to associate the deal with each object that you’d want to appear in the associated objects data.

0 Upvotes
vurazov
Member

How to get engagement's associated company?

Hi dadams!

Thanks for your answer!

If I undrestand you correctly I have to do extra API requests in order to get companyID for each engagement and there is no way to add ids into response for “Get all engagements” even by adding properties params into requests (i see that there is no property/properties params in description for “Get all engagements” method but may be i’m missing something)?

Thanks
in advance

0 Upvotes
Dadams
HubSpot Employee
HubSpot Employee

How to get engagement's associated company?

@vurazov Engagements will only show the items they are directly associated with, so if the engagement is only associated with a deal, you would need to make a separate request to the the deal to see which company the deal is associated with.

Engagements don’t have any properties like a deal or company would, and you’ll always get the full data for the engagements, including the id of the engagement (it’s in the engagement data of a specific record) and the ids of any associated items (in the associations data of the record).

0 Upvotes