Email Events API not returning full list of events


#1

Hello,

I'm trying to get a list of ALL email events for some an email sent out through the HubSpot Marketing hub. I'm doing this by looping through the event list using the offset and hasMore parameters as described here.

My problem is that hasMore becomes False even though I know that there are more events that I have not retrieved. I know that I haven't retrieved all of the events because after retrieving all of the events I can from the API, I count only 23 of type BOUNCE, while the Email performance page inside the HubSpot portal lists the total bounces for this specific email as 1016.

I assume that this has something to do with the bit of the documentation that says the offset parameter "is not meant to be long-lived". What does the documentation mean by this? Are events only stored for a certain amount of time? Is it impossible to access those other events? Any help here would be appreciated.

Best,
Chris K


#3

Hi @chriskeane,

Are you encountering this behavior for multiple campaigns or one in particular? Are you able to consistently reproduce the issue at a specific offset value?

To help me troubleshoot, would you share:

  • Your Hub ID.
  • The affected email's campaignId.
  • The offset value, if applicable.

While I haven't been able to pin down the definition of the "long-lived" distinction, my testing for this topic confirmed that the same offset value could be used within a short window.

That said, the endpoint is intended to be read in reverse-chronological order. Said differently, you should start at the beginning and page backwards for each job rather than store the offset to start with next time. (I don't believe you're doing this, but I wanted to state it explicitly.)


#4

Hi Isaac,

Here is the info you requested. I am encountering this same issue with multiple campaigns, but not at a particular offset value.
Hub ID: 4545485
campaignId: 66865691
offset: Ch4KFQivubSJyub-g60BEKWEweSslu71Txiv8Kji6Sw

For this campaign, my HubSpot portal is telling me that there are 1069 successful deliveries, but I'm only seeing 926 total events. Also, I was storing the offset value after each request. The HubSpot API documentation mentions using the offset value to page through large lists in a few different places, so I thought it'd be fine. What should I be doing instead?


#5

Ok, I did not realize that a campaign could have more than one campaignId, I've found the remaining 40579 events in a second campaign Id. But, I'm still confused as to how I should be paging through these lists if not by feeding in a new offset value with each request.


#6

Hi @chriskeane,

I'm glad you were able to find all the events you were looking for!

Apologies for the confusion. You are absolutely supposed to use the offset value returned from each call to page through subsequent events.

The statement I made:

You should start at the beginning and page backwards for each job rather than store the offset to start with next time.

refers to starting a new series of requests using an offset that previously returned "hasMore": false. If you're still getting "hasMore": true, then you can keep paging through with offset.