I want to send a webhook when a button is pressed on a record :
// Use recordAsync to get the record associated with the button
let record = await input.recordAsync();
// Check if the record exists
if (record) {
// Construct the URL based on the fetched record ID
let url = `https://hooks.airtable.com/workflows/v1/genericWebhook/appXXXXXX/wflXXXXXX/wtrXXXXXX/${record.id}`;
// Fetch data from the constructed URL
await fetch(url);
} else {
console.error("Record not found");
}
but I'm getting this error:
ERROR
at main on line 2
Can anyone help here please? (I don't know scripting)