How to "pick the next row" and go back to the top if needed? (Airtable - Zapier integration)

Topic Labels: Integrations
1630 2
Showing results for 
Search instead for 
Did you mean: 
6 - Interface Innovator
6 - Interface Innovator

Hi There,

I’m searching for ideas how to implement some behavior.

The scenario: I would like to post some of my tweets again at regular interval. Thus I want to create a Tweet scheduler (ex: 1 Tweet per Day) with Airtable and Zapier.

The Data: I already have created the Zapier logic to save the tweets (with some particular hashtags) into an Airtable Table. This list already has something like 40 items and steadily grows each time I tweet with those hashtags.

The logic: Let’s say I have 2 Tweets in my Airtable Table. On the first day, I would like Zapier to pick the first tweet and tweet it. The next day I’d like Zapier to take the second tweet and tweet it.

On the 3rd day, if the table still contains 2 tweets, I’d like Zapier to start again with the first tweet and continue. If I added a 3rd Tweet to the Table, the logic should retweet that 3rd tweet, and then on the next day start anew.

The problem: how to find the next tweet to post?

My first idea was to have a “LastPostedDate” column with the date at which the tweet was posted last. Then I could sort the View by “LastPostedDate”, pick the first item and update that field to the current day. Unfortunately, the sorting is not automatically applied by Airtable yet (see: Allow views to auto-sort). That means: when I update the date, the row doesn’t automatically jump to the “bottom”, I have to sort it out manually, which is a no-go.

The next idea is to keep a row index in Zapier and increment it manually each time I tweet something. This requires a lot more logic on my end, particularly to handle the “out of bounds” index case.

The question: Is there a magic feature I don’t know about that would be very handy in this case? Do you have any other idea how to implement this?

Thanks a lot!

2 Replies 2

The only Zapier trigger you really have to work with here is “new record in view” - so even if there was persistent sorting, Zapier does not have the ability to select the “top” record in a view - only a “new” record that shows up in a view.

What that means is that all your “logic” for selecting the next tweet for Zapier to act on needs to be in Airtable views.

You may not be able to do exactly what you want this way, but you can get something similar for sure. You will have to jockey your tweet records around to different views by using dates derived from the “created at” time of the tweet record, in combination with views filtered by relative dates.

I’m hoping that makes sense - not sure how well I explained it. But you seem like you know what your doing so I’m sure you’ll get the gist…

EDIT - it occurs to me after looking at your other posts that you may be using advanced API features in Zapier/AirDrop, and so you may have other options at your disposal that I am not aware of - so take my post here with a grain of salt.

Thanks for your answer. Indeed, I’m using query formulas. I implemented the second idea and wrote about it here: Not as nice as the other idea… but it works :grinning_face_with_big_eyes: