Help

Select multiple records and invoke third party API

Topic Labels: Integrations
3695 3
cancel
Showing results for 
Search instead for 
Did you mean: 
Vishal_Kapur
4 - Data Explorer
4 - Data Explorer

I’d like to do the following:

  • Allow users to select one or more records in a particular view
  • Click a button, or menu item, or the like – when clicked, Airtable makes a POST request with the selected record data (as JSON) to an API URL that I provide.

The use case is essentially: we keep a table in airtable that tracks membership in a community, and I want to let folks initiate a workflow to onboard new members.

Is this possible?

3 Replies 3

Yes – with a couple of caveats:

  1. You’ll need to use a SaaS integrator such as Zapier or Integromat.
  2. You will have to use a checkbox field rather than Airtable’s built-in selection checkbox to mark records to send.
  3. You can use either an extension-driven button (like Zapier’s ‘Push’ extension, as described in this post from Airtable’s little-known but often excellent blog) or a URL field configured to message a webhook trigger. The integration service will first issue a search to Airtable to identify the selected records and than send an outgoing [whatever] to the external API, including the retrieved data.
  4. If users are coming from a read-only view, I suspect you’ll have to trigger each record individually, as they won’t be able to make a change to the records to indicate selection.

If you have additional questions, feel free to message or PM me.

Vishal_Kapur
4 - Data Explorer
4 - Data Explorer

Thanks, this is very helpful.

It looks like Zapier’s Push extension is a chrome extension, so everyone who wanted to have the button available would need to install the extension, which is not ideal for my use case. Am I understanding that correctly?

You also mentioned a URL field configured to message a webhook trigger – not sure what you’re referencing here, exactly. Could you say more about that?

Sure. You can create an incoming webhook in Zapier, which is essentially a Zapier.com URL that generates a trigger when it gets hit with an HTML ‘GET’ request — like a browser generates when you click on a URL on a webpage. You can define the webhook in Zapier, which will give you the URL to use. Create a formula field that concatenates the webhook URL and the Airtable record ID. I don’t recall the exact syntax Zapier uses, but your formula would be something like

{Webhook URL}&'record_id'&RECORD_ID()

That will create a clickable URL that will trigger a Zapier webhook and pass it the record ID of the Airtable record that contains the formula field. Click the URL, and a GET request is sent to Zapier, triggering the webhook and passing along the record ID. That’s an example of a one-to-one trigger like I mentioned in Item 4.

If users are coming from a view where they have write capabilities, which means they can check a checkbox, you can bundle the RECORD_ID()s together and send a single webhook that passes multiple IDs to Zapier. (Again, I don’t recall the exact syntax, but Zapier has eye-wateringly beautiful documentation for most of their modules, and the help page for ‘Webhooks by Zapier’ clearly explains how to create a multiple-trigger webhook.) You’ll have to add some complexity to your base:

  1. First, create a linked-record field from each record in your main table to a single record in another table — a step that can also be automated with Zapier. Call the new table [Selections].

  2. Add a checkbox field to your main table called {Select}.

  3. Create a formula field in your main table called {Selected} with the formula IF({Selected},RECORD_ID()) .

  4. Create a rollup field in [Selections] called {Selected Records} that follows the link back to [Main] and rolls up {Selected} with an aggregation formula of something like 'ARRAYJOIN(values).

    Note: The exact configuration of both the {Selected} formula and the {Selected Records} aggregation function will both depend on the precise syntax Zapier uses to send multi-trigger webhooks, so you may need to modify them both. You may wish to use an aggregation formula rather than an ag function in {Selected Records} that creates the actual webhook, specifying something like 'http://[ZapierURL]/?'&ARRAYJOIN(values,'&') — but, again, this is entirely dependent on the necessary syntax. You may find it easier to aggregate the record IDs as a rollup field and then build the webhook URL using a formula field. In any case, what you should have when you finish is the properly formatted URL with the aggregated record IDs appended as a search parameter (that is, the part of the URL including ’?' and everything that follows).

  5. Finally, create a lookup field in [Main] that follows the link to [Selections] and looks up {Selected Records}; call it {Webhook}.

To use this multi-trigger webhook, first select all records you wish to send by checking the {Selected} checkbox. This will result in every record in the base containing a copy of the multi-trigger URL in {Webhook}. Clicking on the URL in any record will issue a Zapier trigger for each and every Airtable record selected.

I hope that’s reasonably clear. (It probably would have taken me less time simply to look up the freaking syntax for a multi-trigger webhook than it did to type that caveat about ‘proper syntax’ a half-dozen times, but by the time I realized that, it was too late. :winking_face: )