API queries to replicate the data in the Productivity widget from the Sales dashboard
Hello
I'm trying to use the Engagements API to pull the data from Productivity widget from the Sales Dashboard so I can replicate this widget within Klipfolio.
I'd like to pull each of these metrics for just two specific HubSpot users who are customer service reps for (1) the past 30 days and (2) the past 30-60 days.
Total # of Emails sent to Contact by person A or person B in the last 30 days
Total # of Emails sent to Contact by person A or person B in the last 30 - 60 days
Total # of Calls made by person A or person B in the last 30 days
Total # of Calls made by person A or person B in the last 30 - 60 days
Total # of Tasks done by person A or person B in the last 30 days
Total # of Tasks done by person A or person B in the last 30 - 60 days
Total # of Notes from person A or person B in the last 30 days
Total # of Notes from person A or person B in the last 30 - 60 days
Total # of Email replys received from a contact by person A or person B in the last 30 days
Total # of Email replys received from a contact by person A or person B in the last 30 - 60 days
To clarify - I don't need the line-by-line record details, but just the Total # of each engagement as laid out above.
Can you please advise what the API queries would look like to pull this data?
As of now, when using the Engagement APIs here - Get all engagements, it'll return all the portal's engagements and it's not possible to filter the engagements to specifically return only e.g. TYPE = EMAIL.
There also isn't an endpoint to simply pull out the Productivity report. That said, as discussed in this thread - Pull Sales Performance widget data, one other way that we can get the engagements information is to use the Contact Lists API, where you can create list with the following filter criteria:
#1 Activity created by e.g. Person A or Person B
#2 Activity date is between e.g. 06/01/2019 and 06/30/2019 (note: there isn't a way to set it as last 30/60 days)
#3 Activity type is any of e.g. Email sent to contact
***You can change this accordingly based on the engagements that you'd like to pull in
Once we have the lists set up, we can use this endpoint here: Get a group of contact lists > To get the "size" of the list which fits your end goal as it'll return the total engagements instead of a line-by-line record details.
Pardon for the misalignment of goals in my first response. Now, I understand that you're looking to pull the number of engagements of certain types belonging to certain users. The list workaround that I mentioned previously can only be created for the contact object, so this wouldn't be able to help you get the number of activities.
The best solution here will involve using the Get Recent Engagements API and counting all of the engagements of each type that belong to each user.