Webhook Trigger using button

Hi! I’m not really familiar with how coding works so I just copied how others created their script. What I want to do is trigger the webhook by clicking the ‘Generate Invoice’ button and it will send the data from Airtable to Integromat webhook. Here’s the script that I am trying to run but Integromat says “No bundles were generated by this operation.” Can somebody help me with my script so this thing will run? Thank you!

let url = “https://hook.integromat.com/{inset integromat webhook here}?recordID=Record ID”;

let table = base.getTable(“Invoice”);

let record = await input.recordAsync(‘Select a record to use’, table);

let fieldsToSend = [‘First Name’,‘Last Name’, ‘Invoice Name’,‘Invoice Amount’];

Assuming the Record ID portion of your url variable is supposed to be the ID of the record on which the button was clicked, you need to construct the url to actually include that record ID. Right now you’re declaring the URL prior to selecting the record, I would recommend restructuring what you have so far to something like:

let table = base.getTable("Invoice");
let record = await input.recordAsync("Select a record to use", table);
let url = `https://hook.integromat.com/{inset integromat webhook here}?recordID=${record.id}`;

However, what you have posted is missing the portion that actually submits to a webhook. It also doesn’t connect what fields to send to the webhook url; right now it appears to be a list of field names, but does not retrieve the values for those fields from the selected record.

What scripts were you basing yours on? A lot appears to be missing. If you didn’t have a full example to work from, it may behoove you to hire a developer to construct a full script for you.

@ashpool One thing I’d like to add is that if you are sending the Record ID to Integromat, Integromat will have full access to all of the fields in your Airtable record, so you don’t need to worry about sending field values along with your webhook.

However, if you’re interested in figuring out HOW to send field values with your webhook, that’s where the scripting developers can help you construct a perfect JavaScript for that, as @Kamille_Parks mentioned above.

Also, it seems like your final line in your script will probably need to be something like
await fetch(url);
in order to actually submit the webhook.

1 Like

@ScottWorld @Kamille_Parks Thanks for your help guys. We might look for a developer to solve our scripting problems.