Here’s some initial framework to help you see what’s happening here. We have a weekly email that goes out, it gives users a little game where they can select option A vs. option B.
When they choose an option, they get sent to a landing page on our website.
When they hit our landing page, we want to display a simple message that says, “You chose option A and so did 45% of the other users”. You get the idea, we’re just seeing what the person chose in the email, and comparing it to what other people also chose in the email.
Now for the technical stuff…
The email is being sent to our Contact List and is being sent as a “Timezone Email”, so rough estimate it takes around 3/4 hours to complete. The thing is, we need the API data in real time, so when the user clicks an option on the email, we can compare their click to other clicks on the same email and display it on the landing page.
I have been using the Email Events API because we are tracking clicks, and I’m able to filter it for a time period, as well as a campaign and campaignID.
Few things to note: the campaign is the campaign the email is attached to, the campaignID is actually the Hubspot Internal ID that cooresponds to this email’s send batch.
The problem I’m currently having is that I’m not able to get any API results until the batch is finished running, which ruins the idea of getting real time data.
Here’s the route I’m hitting, please let me know how I can go about getting the data that I would like to receive.
The Route I’m Hitting:
https://api.hubapi.com/email/public/v1/events
The Params I’m passing:
hapikey → our API key
limit → the amount of results I expect to receive back
eventType → click
startTimestamp → 1 week ago value
campaign → hex value of campaign the email is associated with ex. 8ecf3638-79d1-4d20-aba6-d3a1d16882a4
campaignId → Internal Hubspot ID of the send email ex. 97084601
The Response I’m getting:
{
"hasMore": false,
"offset": "CgoY\_\_\_\_\_\_\_\_\_\_9\_",
"events": \[]
}
Here’s some more follow up information.
If I remove the campaign and campaignId, and I just ask for a click type, I CAN see the click of the email that I myself received, even though it’s part of the batch that is still running. As soon as I try to narrow down with the campaignId, the response doesn’t return anything. I can also see in the Hubspot CRM the data for the email even though it’s still running, so we know the data exists.
Is there another route I can hit instead that has real time data?
Is there a route where I can enter the emails ID instead, and get real time data?
I have yet to see a route where I can enter an email ID and get it’s information, that would be super helpful.