APIs & Integrations

jawadfazal
Member

How to get all the marketing emails sent to contacts

Hi, 

I would like to see all the Marketing Emails send to contacts.

I see this information in front-end under contacts but not sure how to get this information through the API.

0 Upvotes
4 Replies 4
WendyGoh
HubSpot Employee
HubSpot Employee

How to get all the marketing emails sent to contacts

Hey @jawadfazal,

 

 

When looking to pull marketing/transactional emails sent to a particular contact, you can use the method shared by Connor on this dev forum thread:

 

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_la...

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

Alternatively, you can create a contact list to pull a list of contact who was sent a particular marketing emails and use the Get contacts in a list | Contact Lists API to pull these contacts.

0 Upvotes
AndreaM02
Participant

How to get all the marketing emails sent to contacts

This is great but it only lets me see the last email.  I need all email history ever, for all time, infinity, etc.   How can we see this easily?  There doesn't appear to be a field in hubspot that captures this which means we either have to do it manually or otherwise.   Any help is much appreciated. 

0 Upvotes
WendyGoh
HubSpot Employee
HubSpot Employee

How to get all the marketing emails sent to contacts

Hey @AndreaM02,

 

If you set the propertyMode to `value_and_history`, you should be able to see the historical emails for all time. 

0 Upvotes
AndreaM02
Participant

How to get all the marketing emails sent to contacts

Hi Wendy - Yes, the problem is that it does not pull in Transactional emails.  So not all emails are accounted for. 

 

We need a better way to pull this data into reports on the platform.  We have to run 14-20 JSON Queries since we can only run 100 at a time.  For enterprise customers, this is not scalable.   Additionally, we have to then run the JSON back through a JSON to CSV Converter so we can work with the file in a more digestable format.  There has to be a better way. 

0 Upvotes