Best answer

Poll-Based Triggers

  • 26 August 2020
  • 6 replies
  • 432 views

Userlevel 3
Badge +1

Hi, I want to create poll-based triggers but the zapier documentation hasn’t covered this topic in detail. I want to know if Poll-Based Triggers are possible without modified_at/last_updated fields? I know we poll data in a reverse chronological order and fetch the latest data in that way but what happen to those API’s which don’t have any timestamp field?

cc: @ikbelkirasan

icon

Best answer by ikbelkirasan 1 September 2020, 22:48

View original

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

Hello! What would you use instead of modified_at/last_updated fields?

Userlevel 3
Badge +1

Hi, @andywingrave I don’t know the answer to that. I need Zapier dev community to help me out here. Can we use some other fields instead of modified_at/last_updated? I’ave created a Poll-based trigger using Zapier Platform UI. I was able to test the trigger (mapped the id with uuid and returned a response in an array) you know the usual stuff with Zapier expects. 

BUT the trigger doesn’t “trigger” an event. I believe this has do with the fact that API I’m working on doesn’t have modified_at/last_updated field. Please let me know how should I proceed from here.

Userlevel 7
Badge +9

I guess what I’m asking, is how can you poll a time based event when you have no time-stamp? I don’t think it’s possible.

Would be very happy to be corrected here if anyone else has an idea?

Userlevel 7
Badge +12

Hi @adilalich and @andywingrave - Indeed, without a timestamp, it’s not possible to know if the item has changed. I have an idea though which might work but haven’t tested it - That is, generate a hash from the item’s JSON data, rename the item’s id field to something else (e.g. item_id) & set the item id to be the generated hash value. So when Zapier polls the API and one item has changed, it’s hash value will be different and will trigger the zap!

There’s a drawback to this method though, when the item changes back to old state, the hash value will be a value that Zapier’s deduper has already seen, so it will filter it out and won’t trigger the zap.

Userlevel 3
Badge +1

Thank you @ikbelkirasan and @andywingrave - Timestamp logic for Poll-Based makes sense for item which are being updated i.e for triggers WHEN AN ORDER IS UPDATED but why do we need timestamp field when we are only fetching a list of products/orders etc? In my case, API doesn’t provide query params that could sort data in reverse order. Can I still create a working poll-based trigger?

My understanding so far:

  • Update poll-based triggers need timestamp fields
  • GET poll-based triggers work on data sorted/filtered in a reverse chronological order.

I will try @ikbelkirasan experimental approach thou.

Userlevel 7
Badge +12

@adilalich - Sorry for the delay. Just got some free time to respond.

To answer your question, what type of trigger are you building, is it “{Something} Created” trigger? If so, this type of trigger doesn’t need timestamps, you’d just return the items the API returned. However, “{Something} Updated” triggers will need a way to create a unique id each time the record is updated so that it bypass the Zapier’s deduper. That’s usually done using updated_at timestamp.