Pull Sales Performance widget data via API

SOLVE
Highlighted
Occasional Contributor

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!

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
Community Manager

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!

3 Replies 3
Community Manager

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!

Occasional Contributor

Thanks @WendyGoh !

 

That was very helpful Smiley Happy 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!

Reply
0 Upvotes
Community Manager

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