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
TypeError: Invalid arguments passed to input.record(label, source, options): • label should be a string, not undefined • source → source should be a Table, not undefined or source should be a View, not undefined or source should be a RecordQueryResult, not undefined or source should be an array, not undefined
at main on line 2
Can anyone help here please? (I don't know scripting)