APIs & Integrations

AMoscato
Member

Getting complete deals data with fewer calls

SOLVE

Hi folks,

I need to get all deals, complete with owner, company, contacts.

From what I have seen I need to make all these calls:

1) get all  deals

for every deal:

2) get the owner with owner api

3) get all companies with associatons

4) get all contacts with associations

For every company association:

5) Get company data

For every contact assosciation:

6) Get contact data.

Not mentioning quotes, that would require further calls.

Is there a way to get all these data in a simpler way?

Or maybe a best practice I don't know?

Thanks in advance

0 Upvotes
2 Accepted solutions
jpsanchez
Solution
Contributor | Gold Partner
Contributor | Gold Partner

Getting complete deals data with fewer calls

SOLVE

Ok so if i get it right its about enrich deals data with other objects data right?

If yes.  is it a one time job or one time job + continue time bases?

 

You can do this within HubSpot. ( most of the job) 

You can do this by many different ways. 

 

For example. You can just ;

  1. create the properties you want in DEALS from Contacts, Companies etc..
  2. Create a propertie in DEALS Bolean like "allpropertiesknow" or name it as you want.
  3. Create a WF . Trigger IF new properties in DEALS are empty. Action Copy from Contacts,Companies,etc to DEALS new propertie with IF UNKOWN ( this means empty with no data). ACTIVATE TRIGGER and ENROLL previous.
  4. CONTINUATION OF THE WF. IF all properties you need are known ( with info). and mark TRUE "allpropertiesknow".
  5. IF YOU HAVE OPERATIONAL PROFESSIONAL YOU CAN TRIGGER WEBHOOK
  6. IF NOT TWO OPTIONS
    1. CREATE A HUBSPOT APP AND CREATE A WEBHOOK TRIGGER FOR CHANGE IN THE "allpropertiesknow" DEAL PROPERTY. from here you can send it to the endpoint you wisht to.
    2. USE HUBSPOT API with cron to REQUEST last DEALS with allpropertiesknow know it. and refine it with a timestamp in order to eliminate potencial duplicates.

Hope it helps!!

Best Bro 😉

JP

 

 

 

View solution in original post

AMoscato
Solution
Member

Getting complete deals data with fewer calls

SOLVE

I have managed to find a solution.

There is a parameter in getting deals that I didn't see, "associations".

Adding it has solved, as I have all the needed associations inside the deal:

 
{{baseUri}}/crm/v4/objects/deal?limit=100&associations=company,contact&archived=false&properties=amount,dealstage,createdate,closedate,dealname,hubspot_owner_id,hs_object_id,hs_deal_stage_probability,num_notes

inside th deal there is a subsection "associations" that contains all the searched deals

View solution in original post

0 Upvotes
7 Replies 7
jpsanchez
Contributor | Gold Partner
Contributor | Gold Partner

Getting complete deals data with fewer calls

SOLVE

Just Quick Question. 

All deals from all pipeplines? Just one?

From deals just deals within a Specific stage like WON for example?..

thanks 

0 Upvotes
AMoscato
Member

Getting complete deals data with fewer calls

SOLVE

Hi @jpsanchez,

and thanks for replying.

Currently we only have a single pipeline, with some hundreds of deals in various stages.

I am going to download all of them, complete with all associations and fields dereferenced (like owner).

As an alternative, I am considering to create lists of all companies, contacts, owners as I iterate through deals and then get all of them as lists.

Do you know if there are better alternatives, or, if with search or bulk lists I can pass a list of objects I want?

0 Upvotes
AMoscato
Solution
Member

Getting complete deals data with fewer calls

SOLVE

I have managed to find a solution.

There is a parameter in getting deals that I didn't see, "associations".

Adding it has solved, as I have all the needed associations inside the deal:

 
{{baseUri}}/crm/v4/objects/deal?limit=100&associations=company,contact&archived=false&properties=amount,dealstage,createdate,closedate,dealname,hubspot_owner_id,hs_object_id,hs_deal_stage_probability,num_notes

inside th deal there is a subsection "associations" that contains all the searched deals

0 Upvotes
Jaycee_Lewis
Community Manager
Community Manager

Getting complete deals data with fewer calls

SOLVE

Hey, @AMoscato! Thank you very much for taking the time to add what worked for you 🙌 — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes
jpsanchez
Solution
Contributor | Gold Partner
Contributor | Gold Partner

Getting complete deals data with fewer calls

SOLVE

Ok so if i get it right its about enrich deals data with other objects data right?

If yes.  is it a one time job or one time job + continue time bases?

 

You can do this within HubSpot. ( most of the job) 

You can do this by many different ways. 

 

For example. You can just ;

  1. create the properties you want in DEALS from Contacts, Companies etc..
  2. Create a propertie in DEALS Bolean like "allpropertiesknow" or name it as you want.
  3. Create a WF . Trigger IF new properties in DEALS are empty. Action Copy from Contacts,Companies,etc to DEALS new propertie with IF UNKOWN ( this means empty with no data). ACTIVATE TRIGGER and ENROLL previous.
  4. CONTINUATION OF THE WF. IF all properties you need are known ( with info). and mark TRUE "allpropertiesknow".
  5. IF YOU HAVE OPERATIONAL PROFESSIONAL YOU CAN TRIGGER WEBHOOK
  6. IF NOT TWO OPTIONS
    1. CREATE A HUBSPOT APP AND CREATE A WEBHOOK TRIGGER FOR CHANGE IN THE "allpropertiesknow" DEAL PROPERTY. from here you can send it to the endpoint you wisht to.
    2. USE HUBSPOT API with cron to REQUEST last DEALS with allpropertiesknow know it. and refine it with a timestamp in order to eliminate potencial duplicates.

Hope it helps!!

Best Bro 😉

JP

 

 

 

AMoscato
Member

Getting complete deals data with fewer calls

SOLVE

Hi @jpsanchez that's erally interesting, I was seeing it only from API side.

Just to better understand, say I want insert in a deal the company and the owner.
I have the couple dealID-CompanyID inside deal associations.

I create a propery in deeals "Company_record".

Then how couls I fill it with action copy? I mean how could I tell Hubspot "go into associations, get the company associated with this deal and copy the record in company_record field?

Moreover, I have searched inside property types, and I can't find a "company" type (whilst there is an user type). So how could I save Company data inside the deal?

I have sales enterprise, so I can definitely trigger the webhook from a WF.

Thanks in advance for your help

0 Upvotes
Jaycee_Lewis
Community Manager
Community Manager

Getting complete deals data with fewer calls

SOLVE

Hi, @AMoscato! To confirm, you are correct that this will require multiple calls. Let's see if our community has any feedback on ways you can be more efficient when making those requests — @jpsanchez @Oezcan @RMones do you have any insight you can share with @AMoscato?

 

Thank you! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes