How to Reference Associated Company

SOLVE
taran42
Contributor

How to do I reference and pull the Associated Company, Associated Company ID, Associated Contacts, and Associated Contact  ID?

 

I found where Associated Company ID is list as associatedCompanyId, but it is not coming through to my JSON file when I get it through Python. I don't see where the others are listed at all. See the string below for my code.

 

 

 

get_all_contacts_url = "https://api.hubapi.com/contacts/v1/lists/all/contacts/all?hapikey=xxxxxxxxx&property=hs_object_id&property=firstname&property=lastname&property=email&property=phone&property=hubspot_owner_id&property=company&property=office&property=specialization&property=jobtitle&property=aycg_member_&property=level&property=associatedcompanyid"

 

 

 

0 Upvotes
1 Accepted solution

Accepted Solutions
taran42
Solution
Contributor

So from everything I can find (through the forums, Slack channel and googling), the fields that I am looking for do not appear to be properties that are readily available. However, I was able to engineer a solution to my problem. I basically ended up pulling the data from the exported JSON, cross referencing contacts/companies/deals, and joining them back onto themselves in Alteryx to get what I needed.

 

For example, for Contacts, the JSON has a property called hs_object_id. That is the same as Associated Contact ID. Then I pulled the firstname and lastname proprties, then combined them to essentially get Associated Contact. So now I have my Associated Contact and Associated Contact ID.

 

I then basically did the same thing for the Associated Company (the name property) and Associated Company ID (the hs_object_id property), pulling them from Companies.

 

Now the tricky part was getting that info from Deals.  The JSON output for Deals has something called associatedVids, which is essentially the Associated Contact ID. It also has a value named associatedCompanyIds, which is the Associated Company ID. Once I figured out how to get those value, I just had to join the data back to the Associated Contact/Company from the other workflows. That gave me all of the associations I was looking for.

 

This should really be documented somewhere. It was only by luck I ran across associatedVids, which isn't even a property. It's just part of the JSON code.

View solution in original post

0 Upvotes
6 Replies 6
dennisedson
Community Manager

Hey @taran42 ,

Have you checked out this new version of the contacts API?  I believe everything you need is here

Thanks,

Dennis




Check out our Community Developer Blog
where we feature our Community driven developer podcast and how to content
0 Upvotes
taran42
Contributor

I took a look at that and I am not seeing the information I need. Perhaps I am overlooking it. I am wanting to get the Associated Company, Associated Company ID, Associated Contacts, and Associated Contact  ID. For example, right now if I want to pull the last name from the contacts, I use &property=lastname in the URL. I am wanting to find what that equivelent is for the Associated Company, etc. I saw in another forum post that associatedCompanyId was a property, and I put it in my URL string, but it does not pull anything.

 

Does that make sense?

0 Upvotes
taran42
Contributor

I have yet to be able to find out how to get the Associated Contacts/Compaies/Deals property. If I go into my account settings, I can see Associated Contacts and Associated Deals listed under my Company Properties (see screenshot). They are listed as num_associated_contact and num_associated_deal.

 

taran42_0-1602618649513.png

 

If you look to the right to see how many contacts use that property, it displays 0. However if I export a CSV of the data, almost all of my 292 companies have at least 1 deal association and most have a contact association as well.

 

taran42_1-1602618832385.png

 

How is it that HubSpot displays 0 Associated Deals/Contacts? I'm assuming the reason I cannot pull any Associated Deals via the property in JSON is that HubSpot is displaying 0 associations (if a value is null, then the JSON will not display anything for that property). 

 

Back to my original question then: how can I get the Associated Contact/Company/Deal from HubSpot?

0 Upvotes
dennisedson
Community Manager

@taran42 !

Hello friend!  Have you looked at this endpoint that displays all contact properties

Thanks,

Dennis




Check out our Community Developer Blog
where we feature our Community driven developer podcast and how to content
0 Upvotes
taran42
Contributor

@dennisedson Your avatar reminds me of my dad everytime I see it. He raises bantam chickens as a hobby.

 

So that link is helpful, but unfortunately it does not solve my problem. In using that endpoint I can confirm which properties are/are not available. Let's take Contacts for example. I am looking to get the Associated Company ID and Associated Company property for each Contact. I now know that I can get the Associated Company ID by using the property associatedcompanyid. However where can I get the Associated Company? Associated Company ID is just a long number and not very useful for my human eyes. I need to know what that is in a text string format. How do I obtain what what company correlates to a compay ID? An Associated Company property doesn't seem to exist from what I can tell.

 

Below are the properties I am looking for and can't find. If I export an Excel file out of HubSpot with the "All Properties" button checked, the values below show up and are populated. That is except for the two for Companies properties, which I don't think I need, but the other six are critical to my project. I need to find a solution to this. I have exhausted Google, forums and the Slack channel at this point.

 

Contacts

Associated Compay ID = associatedcompanyid

Associated Company = ?

 

Companies

Associated Company ID = ?

Associated Company = ?

 

Deals

Associated Company ID = ?

Associated Compay = ?

Associated Contact ID = ?

Associated Contact = ?

0 Upvotes
taran42
Solution
Contributor

So from everything I can find (through the forums, Slack channel and googling), the fields that I am looking for do not appear to be properties that are readily available. However, I was able to engineer a solution to my problem. I basically ended up pulling the data from the exported JSON, cross referencing contacts/companies/deals, and joining them back onto themselves in Alteryx to get what I needed.

 

For example, for Contacts, the JSON has a property called hs_object_id. That is the same as Associated Contact ID. Then I pulled the firstname and lastname proprties, then combined them to essentially get Associated Contact. So now I have my Associated Contact and Associated Contact ID.

 

I then basically did the same thing for the Associated Company (the name property) and Associated Company ID (the hs_object_id property), pulling them from Companies.

 

Now the tricky part was getting that info from Deals.  The JSON output for Deals has something called associatedVids, which is essentially the Associated Contact ID. It also has a value named associatedCompanyIds, which is the Associated Company ID. Once I figured out how to get those value, I just had to join the data back to the Associated Contact/Company from the other workflows. That gave me all of the associations I was looking for.

 

This should really be documented somewhere. It was only by luck I ran across associatedVids, which isn't even a property. It's just part of the JSON code.

View solution in original post

0 Upvotes