APIs & Integrations

cfrye_1st_page
Participante | Partner
Participante | Partner

Pull Sales Performance widget data via API

resolver

Hello. I'm trying to use HubSpot API's to duplicate the data shown in the Sales Performance widget from the Sales Performance Standard Dashboard. The Report Settings for the Sales Performance data are:

Date Range = this entire month

HubSpot Owner = Person A OR Person B

 

The metrics are:
Contacts assigned (both this month and last month)

Contacts worked (both this month and last month)

 

Can this info be pulled via API? If so, what would a sample API call look like to pull this info?

 

I tried solving for this by clicking "Sales Performance" header link and viewing the resulting report and filters, however the Deals list which shows up has zero records. When I strip away the filters in the Deals list, it appears that the Deal Owner for all deals are set as Unassigned so that was a dead end.

 

FWIW I'm pulling this info into Klipfolio.

 

Any guidance is greatly appreciated!

0 Me gusta
1 Soluciones aceptada
WendyGoh
Solución
HubSpot Employee
HubSpot Employee

Pull Sales Performance widget data via API

resolver

Hi @cfrye_1st_page,

 

I hope all is well with you Smiley Happy

 

We currently do not have an API to pull custom report data, that said if you're looking to pull data based on these two metrics:

  • Contacts assigned (both this month and last month)
  • Contacts worked (both this month and last month)

I'd suggest looking into our Contact Lists API where we can set filters to pull contacts into list. For this, we can approach in two ways:

#1 You can create a contact list directly via the API here (Create a new contact list)

or 

#2 You can create the contact list directly in your HubSpot portal

 

We can use the following filter criteria to pull contacts based on the above metrics:

  • Contacts assigned: owner assigned date is between (under the filter type -> 'contact properties') e.g. 06/01/2019 and 07/10/2019
  • Contacts worked: last activity date is between (under the filter type -> 'Contact properties') e.g. 06/01/2019 and 07/10/2019

Once the list has been created, we can use this endpoint here (Get contacts in a list) to return contact(s) that are in that list

 

Additional Resources:

Learn more about the sales performance widget metrics

Learn more about HubSpot's default contact properties

 

Also, if you're looking to import data from HubSpot into a user's Klipfolio dashboard, we do have an integration with Klipfolio and you can explore more here: [HubSpot Connect] - Klipfolio Integration

 

Hope this helps to clarify!

Ver la solución en mensaje original publicado

5 Respuestas 5
WendyGoh
Solución
HubSpot Employee
HubSpot Employee

Pull Sales Performance widget data via API

resolver

Hi @cfrye_1st_page,

 

I hope all is well with you Smiley Happy

 

We currently do not have an API to pull custom report data, that said if you're looking to pull data based on these two metrics:

  • Contacts assigned (both this month and last month)
  • Contacts worked (both this month and last month)

I'd suggest looking into our Contact Lists API where we can set filters to pull contacts into list. For this, we can approach in two ways:

#1 You can create a contact list directly via the API here (Create a new contact list)

or 

#2 You can create the contact list directly in your HubSpot portal

 

We can use the following filter criteria to pull contacts based on the above metrics:

  • Contacts assigned: owner assigned date is between (under the filter type -> 'contact properties') e.g. 06/01/2019 and 07/10/2019
  • Contacts worked: last activity date is between (under the filter type -> 'Contact properties') e.g. 06/01/2019 and 07/10/2019

Once the list has been created, we can use this endpoint here (Get contacts in a list) to return contact(s) that are in that list

 

Additional Resources:

Learn more about the sales performance widget metrics

Learn more about HubSpot's default contact properties

 

Also, if you're looking to import data from HubSpot into a user's Klipfolio dashboard, we do have an integration with Klipfolio and you can explore more here: [HubSpot Connect] - Klipfolio Integration

 

Hope this helps to clarify!

PowerMyAnalytic
Colaborador líder

Pull Sales Performance widget data via API

resolver

Hi @WendyGoh,

 

Thanks for answer.

 

I have some difficulties.

The solution is good when the field value can't be changed, like contact "create date" or "owner assigned date" and/or the date range is "until today". 

But using "last activity date" is kind of tricky, because its value change over time.

For example, if contact had one activity in this week and one activity last week, if I set the report date range to be "Last Week" the report will return 0 instead of 1 because only the last activity time is recorded and it not in the settings date range. 

 

Possible solution is to populate the "last activity date" property history, but it is too hard to manage. 

 

After almost a year from the last answer, I want to re-check,

Is there an intention to make a simple andpoint (input: date range, output: results)

for "Contacts created and worked totals with deals created and won totals" report?

0 Me gusta
WendyGoh
HubSpot Employee
HubSpot Employee

Pull Sales Performance widget data via API

resolver

Hey @PowerMyAnalytic,

 

We recently released the CRM search endpoint - CRM API | Search which allows you to search through CRM objects. 

 

In this case, you can search through the property 'last activity date'. 

0 Me gusta
cfrye_1st_page
Participante | Partner
Participante | Partner

Pull Sales Performance widget data via API

resolver

Thanks @WendyGoh !

 

That was very helpful 🙂 I've setup Contacts Lists and will work with those Contact List data through the Contact List API.

 

Now a followup question - I am looking for the number of contacts in the lists as opposed to the actual data about those contacts. Here's an example of the API call I'm using.

https://api.hubapi.com/contacts/v1/lists/###/contacts/all?count=250

 

I'm running into a problem now because the size of my contact list (4500+) exceeds the amount of records which can be returned in a single API call. 

 

Is there an method to just return the number of records in the contact list as opposed to returning the entire contact list dataset? I am hoping to avoid using the vidOffset since I expect that will change day-to-day and I don't know of a great way to deal with that within Klipfolio.

 

Thanks again!

0 Me gusta
WendyGoh
HubSpot Employee
HubSpot Employee

Pull Sales Performance widget data via API

resolver

Hey @cfrye_1st_page ,

 

Glad that that's helpful! 

 

When looking to get the number of contacts in a list, we can use this endpoint here: Get a group of contact lists | Contact Lists API

  • First, you can get the ID of any list in HubSpot by looking at the URL. It will have this format:
https://app.hubspot.com/contacts/{{portalId}}/lists/{{listId}}
  • You can then use the listId in the request URL parameter e.g.

 

https://api.hubapi.com/contacts/v1/lists/batch?listId={{listId}}&portalId={{portlId}}
  • The "size" key will contain the number of contacts in the list