Help

Script to delete records automatically via a webhook

2292 8
cancel
Showing results for 
Search instead for 
Did you mean: 
Julie_Andrieux
4 - Data Explorer
4 - Data Explorer

Hey there !
I would like to bulk delete records that match a certain criteria in the app Front.
I will link Front and Airtable via webhook but I wonder how to write a script to delete only the right records.
Thank you !

8 Replies 8

I don’t know JavaScript, so somebody else will need to chime in to help you with your specific request for a script that can do this for you.

The reason that I haven’t learned JavaScript is that I personally think it’s much easier & simpler to use an automation tool that doesn’t require any programming code knowledge at all.

What you want to do can be accomplished very simply in Make, which doesn’t require any coding at all, and has native integration with both Front & Airtable:

p.s. As a top Airtable consultant, I can help you set this up. If your company has a budget to hire an Airtable consultant, please free to contact me through my website: Airtable consulting — ScottWorld

Hi Julie, this thread contains a script that will delete all records in a specific view, which should be all you need I think.

You’ll need to make some minor adjustments to make it work within an automation though, let me know if you need help with that

Welcome to the AIrtable community!

What will be sending the webhook? How will that webhook be triggered? What information will it have to uniquely identify the records?

Does your app need to search Front to see if the records meet the criteria? Or will Front know which records need deleting, and Front will send the webhook?

What is your level of experience with JavaScript?

The reason that I haven’t learned Make is that I personally think it’s much easier & simpler to use an automation tool that is native to Airtable and doesn’t require and additional subscription or a new (visual) programming language.

I’m glad we’re friends, despite all our differences. Make doesn’t require writing scripts, but it does require understanding how to think logically, which is most of what programming is. The rest of scripting is grammar and spelling.

I’m thrilled that you love JavaScript, and that you get to use it frequently in Airtable!

However, I would suspect that the vast majority of people who came to Airtable were hoping for a low-code/no-code DIY experience. While Airtable might natively support writing JavaScript code, it is still an entire programming language which is not easy for most people to learn.

Nor should they need to learn it, in my opinion, For example, why would a veterinarian who is setting up Airtable to keep track of his pets want to spend weeks or months learning a computer programming language so that he can create one simple automation in Airtable? It’s a huge waste of his time and energy and money. He has a practice to run.

Calling Make a programming language makes it sound more complex than it really is. While it can definitely get complicated, for most people’s needs it is as easy as snapping together legos. Anybody can look at a colorful ball that says “create new Airtable record” and know immediately what it means. Make is mostly point-and-click (and in plain English).

You left out vocabulary words, which is the big one. Scripting is an entirely different language, like learning Greek or Hungarian. Some people want to learn foreign languages. The majority of people don’t need to. People specifically come to Airtable for its ease of use… and snapping 2 colored balls together in Make carries on that ease of use.

But the great news is that there is something for everyone! For computer programmers like you, there’s scripting! :slightly_smiling_face: And for computer programmers like me, there’s Make! :slightly_smiling_face:

The irony here is that we’re both computer programmers, but after 30+ years of writing code, I’m on a much-needed break from writing code for now! :winking_face:

Hey ! Thank you for getting back to me ! The mailing application Front will be sending the webhook and will be triggered by an email with a specific tag. It will have a set of email adresses, and names to identify the records.
And I have a little experience with Java Script !

Awesome!

You can learn more out Airtable receiving webhooks in this support article. Note that the data must be sent via “post” not “get”. Do you know if Front is capable of generating a “post” request without using a third party service? (I’m curious about Front and would appreciate it if you share any info on the Front side if this integration.)

Your script will need to get all the records from the table using selectRecordsAsync.

Then you will need to use JavaScript to identify the target records. I like to use an array filter for this. You will need to use getCellValue to get the cell values for each record.

Finally, you will need to use deleteRecordsAsync to delete the records.

And, for those people who are reading this thread in the future who want to do this using Make (instead of JavaScript), here is a screenshot of the simple 3-step process that you would setup:

Screen Shot 2022-08-24 at 10.30.37 AM