I am creating a weekly internal sales report, and need to pull data from a few sources and compile them into one easy to read email. One of the metrics I need to be reporting on is emails sent and meetings booked/conducted. This is all readily available in HubSpot. I am able to create the report and then share the report, however this would mean that it is sent in a seperate email, which is not what I want.
Hey @GijsTempelman , You can capture the meetings within a date range using the /crm/v3/objects/emails/search and /crm/v3/objects/meetings/search endpoints by adding a filterGroups then use the total count for it.
Sample filterGroups:
{
"filterGroups": [{
"filters": [{
"propertyName": "hs_meeting_start_time", // or "hs_timestamp" for emails
"operator": "BETWEEN",
"value": "1579514400000", // Start (milliseconds)
"highValue": "1642672800000" // End (milliseconds)
}]
}]
}
Hey @GijsTempelman, well for emails you need to add the additional scope sales-email-read which is under the "Other" in the scope selection. Unfortunately, I'm not aware of any workaround for this.
3 weeks ago
- last edited
3 weeks ago
by BérangèreL
Participant
I really appreciate you sharing this use case about pulling activity data for your sales reports. This is a common challenge when building automated reporting workflows in n8n.
For accessing meetings and email activity through the API you'll want to use the Engagements API. You can query meeting engagements and email engagements separately and then aggregate the counts. In n8n you can set up HTTP Request nodes to call the engagements endpoint with filters for date ranges and engagement types. The tricky part is handling pagination if you have lots of activities but n8n makes it pretty straightforward with loops.
For your weekly report workflow I'd suggest pulling data for each rep individually and then using n8n's merge or aggregate nodes to combine everything into your final email format.
Hey @GijsTempelman, the CRM v3 Emails and Meetings objects, HubSpot doesn’t use separate crm.objects.emails.* or crm.objects.meetings.* scopes. Access is granted via the contacts object scope. Please add the crm.objects.contacts.read scope then see if that works.
Hi @Christensen, thanks for the speedy reply. I can definitely access the contacts object, but then I am at a loss for how to get a count of all meetings conducted and emails sent within a date range.
Hey @GijsTempelman , You can capture the meetings within a date range using the /crm/v3/objects/emails/search and /crm/v3/objects/meetings/search endpoints by adding a filterGroups then use the total count for it.
Sample filterGroups:
{
"filterGroups": [{
"filters": [{
"propertyName": "hs_meeting_start_time", // or "hs_timestamp" for emails
"operator": "BETWEEN",
"value": "1579514400000", // Start (milliseconds)
"highValue": "1642672800000" // End (milliseconds)
}]
}]
}
Hi @Christensen, I'm trying to fetch email data from HubSpot using the /crm/v3/objects/emails/search endpoint in an HTTP Request node, but I'm getting a 403 error saying I'm missing required scopes.
The error states: "This app hasn't been granted all required scopes to make this call. Required scope: sales-email-read", which isn't one of the scopes I can allow access to.
The meetings scope and count work perfectly. Just cant get the emails up and running.
Hey @GijsTempelman, well for emails you need to add the additional scope sales-email-read which is under the "Other" in the scope selection. Unfortunately, I'm not aware of any workaround for this.