I am looking to use the Button run script field in Airtable to send specific data from my table into Zapier.
Does anyone have a template script they can share? This is what I have so far.
let url = "https://hooks.zapier.com/hooks/catch/TKID?recordID=?name=?";
let table = base.getTable("Table 1");
let view = table.getView("Grid view");
let record = await input.recordAsync("Pick a record", view);
let name = record.getCellValueAsString("Name")
let email = record.getCellValueAsString ("Email")
await fetch(url + record.id + "%name=" + name + "%email=" + email);
My understanding is the steps are:
- Create Button field
- Add in script that posts to Zapier webhook
- Catch data from Airtable
- Run rest of the Zap
Just looking for help on the Airtable script side.
You could use a script, but it’s unnecessary. Your button can just trigger the webhook URL on its own.
Just add the Record ID of the record as a parameter to the end of the webhook URL, and then have Zapier find the record based on its ID.
(You can also add in extra parameters if you’d like, but those are unnecessary as well.)
@ScottWorld ah thanks so much. Sorry very new to this.
So in the URL formula then I right now have the below but it isn’t splitting off
Email on the Zapier end. Assuming I am doing something wrong syntax wise?
You’ve got your URL setup incorrectly. It needs to look like this:
"https://hooks.zapier.com/hooks/catch/TK?name=" & ENCODE_URL_COMPONENT(Name) & "&email=" & Email
However, like I mentioned above, it’s easier & more versatile to just send the record ID to Zapier:
"https://hooks.zapier.com/hooks/catch/TK?id=" & RECORD_ID()
@ScottWorld Thanks for the help. Really appreciate it.
This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.