Help

Error in sending webhook via script (identical in same table, one works one doesn't)

Topic Labels: Automations Data Integrations
610 2
cancel
Showing results for 
Search instead for 
Did you mean: 
fsuendl
4 - Data Explorer
4 - Data Explorer

I have two buttons on the same table, each triggers a script and then sends a webhook to a third-party service. One works and the other does not. During the debugging process, I copy and paste the exact same code into the two scripts, and one works, but the other always says "O: TypeError: Failed to fetch at line 10" and that's the line that triggers the Webhook. It's rather strange given the two scripts are identical. Is there any limitation that one cannot have two scripts within one table? My code below.

let table = base.getTable('URL');
let record = await input.recordAsync('Select a record', table);
let websiteContent = record.getCellValue('Website_Content'); // Retrieve the content from "Website_Content" column
let recordId = record.id; // Get the record ID

// Include the record ID and the website content in the webhook payload
let payload = JSON.stringify({ websiteContent: websiteContent, recordId: recordId });

// Send the data to the Azure Function
let response = await remoteFetchAsync('my webhook url', {
method: 'POST',
body: payload,
headers: {
'Content-Type': 'application/json'
}
});

let result = await response.json();

// Optionally update the Output column with a placeholder or message until the async process completes
await table.updateRecordAsync(record.id, {
'Website_Content': "Processing..." // 
});

 

2 Replies 2
fsuendl
4 - Data Explorer
4 - Data Explorer

Anyone had similar experience before? I have tested it multiple times, in same table, different table, same base, different base. Exact same code, same trigger. My original one works, but all the others have the same error. Any pointers would be very much appreciated!

Sorry, I don’t know much about scripting, but here are the 2 different scripts that I use to send Airtable records to Make’s custom webhooks:

 https://air.tableforums.com/t/sending-airtable-data-to-an-external-webhook-such-as-make-com/159