APIs & Integrations

HubspotDevelope
Member

Getting History of Marketing Emails using API

Hi.  I am syncing Hubspot with a CRM database.

One person uses Hubspot to generate email newsletters and send to clients.  We want to update the CRM database with every email that was sent.  A CRM user will want to see all the emails sent by Hubspot to each user - inside the CRM application

I can call the Hubspot API and get all the Marketing Emails sent.  Each marketing email will have contact lists that they sent the emails to.   Each contact list will have have contacts that the emails were sent to.

Problem is - Let's say I created a marketing email back in february and sent out a newsletter.  Since February - several people have been added to the contact list and several people removed.  If I try to sync the emails sent in February - I'll not have the correct people since some people in the list changed.

Can you suggest a better approach or help me understand this better?

I'd rather not call Hubspot for every contact to get the emails sent.  Seems like that would be hundreds or thousands as many calls

Thanks

0 Upvotes
3 Replies 3
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Getting History of Marketing Emails using API

Hey @HubspotDevelope ,

 

Apologies, I'm not sure I'm 100% clear with the issue you're describing. Is the issue that the February Newsletter you're describing has been sent to more contacts since the original send? Also, are you currently using the Marketing Email API to pull the email send data?

 

One thing I'd mention off the bat is that, if you need more granular data on marketing email sends to specific recipients, you might consider using the Email Events API to pull data related to specific recipients.

0 Upvotes
HubspotDevelope
Member

Getting History of Marketing Emails using API

Thank you for your reply

 

(((Is the issue that the February Newsletter you're describing has been sent to more contacts since the original send? Also, are you currently using the Marketing Email API to pull the email send data?)))

Correct.  Let's say we send February Newsletter, then add and delete contacts from contact list.  Then we try to pull receipents of newletter using Marketing Email API.  In the Marketing Email API is a contact list of receipents.  Does that contact list have the original list of receipents (accurate) or the changed list (not accurate)?

 

(((if you need more granular data on marketing email sends to specific recipients, you might consider using the Email Events API to pull data related to specific recipients.)))

Yes, was thinking the Marketing Email API approach requires fewer calls to Hubspot.  Instead of calling hubspot for each contact (Email Events API) - one call to Marketing Email API will get me all marketing emails, then a second call to get all contacts lists - gets me all the contacts. If the Marketing Email API contact lists are accurate - then that requires much fewer calls to Hubspot.  If the marketing email API contact lists are not accurate - then I'll probably call Email Events API for each contact (ugh)

Thanks again

0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Getting History of Marketing Emails using API

Hey @HubspotDevelope ,

 

The vids_included, vids_excluded, mailing_lists_included, and mailing_lists_excluded fields don't change over time based on further sends (e.g. Send to more). So if you send to 5 individual contacts in the initial send, those vids will appear in vids_included. That array of vids won't change if you later send to more vids.

 

However, while the lists that appear in mailing_lists_included also don't change, the contacts within those lists might change. So if you're using contact lists to send emails, you won't get the same moment-in-time snapshot you would if you sent to contacts individually.

 

You might consider creating smart lists that use marketing email filters with dates. For example, you could create a list of contact using the following filter: "was sent HubSpot Test Email between 12/01/2019 and 12/02/2019"

0 Upvotes