I was thinking about how to add some functionality to a base and, for the base user, how they would trigger this. In most web apps functionality will be invoked by the click of a button - save edits, delete a record and so on - but this button functionality isn’t available in Airtable. But…Zapier provides a webhook component that can be invoked to kick off a Zap.
I frequently use Zaps in my bases and they are mostly triggered by the standard Airtable triggers - new record or new record in a view. One downside to this, which this demo gets around, is that a record can only be triggered once (or once as a new record and once in a given view). By using webhooks to trigger the functionality, it can be executed an arbitrary number of times for any record.
My demo for this is based on translating content from one language to another. I have some text in English and I want to translate each record of content into German:
I set up a Zap that:
gets the EN content
translates the EN content
writes the translated content into another field in the same record:
The webhook component is a Catch Hook and I append the webhook URL with the record ID of the Airtable record:
The record ID gets passed from the webhook component to the 2nd component in my Zap - a run python component with this code:
The output of this component is the EN text and this gets passed to a Zapier translate component, which translates it to German, passing the translated text to the last component - another Run Python. This component takes the translated text and sends it back to the same record in Airtable using:
Once all set up, you can click on the webhook URL in any record and trigger the translation Zap:
A few comments:
the functionality here is a translation, but, of course, it could be anything (yes, I know AT has a translation block already :winking_face: )
I’ve shown this with an update action per record, but you could easily have the same webhook URL in every record (i.e. no record ID params) and the webhook triggers an update to multiple records in a view - in this example, maybe all of the records without a German translation.
Clicking on the webhook URL opens a new browser tab and you get a JSON response to the call. A bit tedious, but not terrible.
This Zap uses 4 components, which needs a paid Zapier plan. I’ve used webhook triggers with fewer components, so it is doable on a free Zapier plan.
I’ve used run python components, which, obviously, you need some familiarity with code to be able to implement. However, very possible that you could do:
Webhook -> AT Find Record -> Do Something -> AT Update Record
which would be a no-code option.
For the coders amongst you, lots of opportunities to implement more complex functions than AT natively provides. One of the things that AT doesn’t do right now, for example, is allow you to iterate on items in an array field - example, sort and dedupe an array of values. Very easy to do this in a code component triggered by a webhook call. (Something I might have a go at when I get some time).
Anyway, hope you might find a use for this. Any comments or questions - let me know.