APIs & Integrations

BambooBox
Member

Get email events API - parameter startTimestamp not being respected

SOLVE

Hi,

 

I am trying to use the API below to fetch the events for a campaign post a given timestamp -  https://legacydocs.hubspot.com/docs/methods/email/get_events

and using the parameters as provided in the documentation so my URL looks like below:

https://api.hubapi.com/email/public/v1/events?campaignId=<XX>&limit=1000&startTimestamp=1664947667

 

As per the documentation, I expected the API to return all the events for the specified campaign(XX) post the time in startTimestamp parameter. But the API is returning me events even before the time provided.

Is this the correct behavior or am I missing anything? Is there any API to get the event data for a campaign after a specific date?  Please suggest.

 

Best Regards,

Ashima

 

2 Accepted solutions
coldrickjack
Solution
Top Contributor

Get email events API - parameter startTimestamp not being respected

SOLVE

Hey @BambooBox,

 

I think the issue is to do with the value you are including for the startTimestamp query parameter. HubSpot expects the value to be in milliseconds. The value you are passing (1664947667) translates to Tue Jan 20 1970 06:29:07. So it would make sense that you are getting back all of that data. 

I'm not sure what date range you are trying to work within but if I wanted to get all of the events for a campaign on or after 1st of Jan 2022 I'd do something like this:

 

https://api.hubapi.com/email/public/v1/events?campaignId=61935014&startTimestamp=1640995200000&limit=20

 

View solution in original post

JBeatty
Solution
Guide | Diamond Partner
Guide | Diamond Partner

Get email events API - parameter startTimestamp not being respected

SOLVE

@BambooBox,

 

To build upon this, it looks like the timestamp you entered "1664947667" is in seconds, while HubSpot expects milliseconds for its timestamp so if you want to do Wednesday, October 5, 2022 5:27:47 AM you would do "1664947667000" instead.

 

Best,

✔️ Was I able to help answer your question? Help the community by marking it as a solution.

Joshua Beatty
Software Developer with Pearagon

Still have questions? Let's Talk

View solution in original post

4 Replies 4
coldrickjack
Solution
Top Contributor

Get email events API - parameter startTimestamp not being respected

SOLVE

Hey @BambooBox,

 

I think the issue is to do with the value you are including for the startTimestamp query parameter. HubSpot expects the value to be in milliseconds. The value you are passing (1664947667) translates to Tue Jan 20 1970 06:29:07. So it would make sense that you are getting back all of that data. 

I'm not sure what date range you are trying to work within but if I wanted to get all of the events for a campaign on or after 1st of Jan 2022 I'd do something like this:

 

https://api.hubapi.com/email/public/v1/events?campaignId=61935014&startTimestamp=1640995200000&limit=20

 

BambooBox
Member

Get email events API - parameter startTimestamp not being respected

SOLVE

Thanks, this was helpful

0 Upvotes
JBeatty
Solution
Guide | Diamond Partner
Guide | Diamond Partner

Get email events API - parameter startTimestamp not being respected

SOLVE

@BambooBox,

 

To build upon this, it looks like the timestamp you entered "1664947667" is in seconds, while HubSpot expects milliseconds for its timestamp so if you want to do Wednesday, October 5, 2022 5:27:47 AM you would do "1664947667000" instead.

 

Best,

✔️ Was I able to help answer your question? Help the community by marking it as a solution.

Joshua Beatty
Software Developer with Pearagon

Still have questions? Let's Talk

TiphaineCuisset
Community Manager
Community Manager

Get email events API - parameter startTimestamp not being respected

SOLVE

Hi @BambooBox 

 

Thank you for reaching out.

 

I want to tag some of our experts here - @coldrickjack @Bryantworks @JBeatty do you have any thoughts for @BambooBox on this? 

 

Thank you!

Best

Tiphaine


Saviez vous que la Communauté est disponible en français?
Rejoignez les discussions francophones en changeant votre langue dans les paramètres !

Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !


0 Upvotes