Question

How to get the time of the last trigger poll?

  • 5 January 2022
  • 6 replies
  • 242 views

Userlevel 1

Similar to another post from about a year ago (here), I’m wondering if there is a way, in a trigger function, to find out when the last poll for this trigger was done?  Without that, it’s not clear how to ensure that my API request returns all the latest data.  I can get an arbitrary amount of new data or get all the data from the beginning of time, but neither of those seems completely satisfying.

Thanks in advance.

-Mark


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

6 replies

Userlevel 7
Badge +9

The most common, and recommended, approach is to implement your endpoint and/or configure your polling API request such that you return a paginated list of objects in reverse chronological order. Include enough data in this response, or result page, to include any new data/events since the last poll - anywhere from 5 to 15 minutes depending on the user’s Zapier subscription plan. Queues can get backed up, so adding in buffer there is a really good idea so users don’t miss data. 

Including all data since the end of time is not recommended for a normal Zap polling trigger (Supporting the still-in-beta-at-the-time-of-this-writing Transfer feature is a different answer). Zapier will only grab the top of the result set anyway, the latest ~100 objects in the array. 

 

Userlevel 1

Include enough data in this response, or result page, to include any new data/events since the last poll - anywhere from 5 to 15 minutes depending on the user’s Zapier subscription plan.

 

My point was that if we had a way to obtain the actual time of the last poll we could make this more precise and not have to figure out the user’s Zapier subscription plan (which I doubt we have access to anyway). 

 

Including all data since the end of time is not recommended for a normal Zap polling trigger

 

That was an exaggeration on my part.  I wouldn’t actually do that, though in theory that’s really the only way to ensure that you get all the data since the user’s Zap’s last poll.  I guess that wouldn’t really work in practice, anyway if, as you say, Zapier only grabs the latest ~100 items.

Userlevel 7
Badge +9

I should also point out that to have precise control, and the most efficient implementation, rest hooks are a superior option to build triggers.

Userlevel 1

I should also point out that to have precise control, and the most efficient implementation, rest hooks are a superior option to build triggers.

 

Indeed, but unfortunately I don’t have that option right now. 

Userlevel 1

@Zane  Is there a way we can know the Zap User’s subscription plan to identify the polling time in run time?

Userlevel 7
Badge +9

@venkatesh, no, subscription info is not surfaced in the bundle. You could probably derive that from your API logs, but I feel like trying to implement a solution for those specifics is setting your integration up to be brittle.