How can I get list of every email sent to contacts


#1

I need to get an export of all emails sent to contacts. Essentially a concise dump of marketing emails activities.

Anyway to get this?


#3

Hi @jayjiang, there's no easy way to pull this info. You can try the email events API to get specific events that happen in an email: https://developers.hubspot.com/docs/methods/email/email_events_overview in conjunction with pulling templates with the templates API, but no way to pull the exact information you're seeking.


#4

So there's no export activities api to get a list of emails in the screenshot below?


#5

Hi @jayjiang, sorry, I might have misspoke/misunderstood you. If you just need the names of the emails sent to a contact you should be able to use the get contact by vid endpoint to pull the names of the emails that were sent to a contact. You can do this by specifying the contact property "Last marketing email name", and set the propertyMode to value_and_history. You could then utilize the Email Events API to pull opens/clicks and other email events for a specific email address.

For the GET contacts endpoint, the URL would look something like this:

https://api.hubapi.com/contacts/v1/contact/vid/191/profile?hapikey=XXXXXXXXXXXX&property=hs_email_last_email_name&propertyMode=value_and_history

For the GET email events endpoint, your URL would look something like this:

https://api.hubapi.com/email/public/v1/events?hapikey=XXXXXXX&recipient=emailgoeshere


#6

Is there anyway to get the information at scale for 60k contacts?


#7

Hi @jayjiang, you should actually be able to use the get all contacts endpoint with the property history above to page through your contacts 100 at a time, then make a subsequent call to the GET email events endpoint based on the email addresses returned, but this would be pretty heavy on API calls. As I noted previously, it's technically possible, but probably best to look at higher level data.