Lee_Thomas wrote:
let inputConfig = input.config();
let id = inputConfig.RecordID;
let scriptURL = “https://script.google.com/macros/s//exec?”;
let urlRequest = (scriptURL + id);
console.log(scriptURL + id);
try{
let response = await fetch(urlRequest, {method : “Get”, redirect : “follow”});
console.log(await response.json());
} catch(e){
//nothing
}
Here is the code maybe I’m doing something stupid.
From my testing so far.
-
Using try then testing the script completes successfully but no data is received to activate the apps script
-
Adding redirect : “follow” changes the error to: TypeError: Requests that follow redirects are not supported currently
-
Swapping out the apps script url for ‘https://api.github.com/orgs/Airtable’ everything functions as expected and a normal response is received.
I was about to respond to this message when I saw your recent messages.
I had intimated earlier that it was likely something else that was causing you to believe your action script was inadequate. It wasn’t - it was something in your web app deployment or the code, or both, right?
This is bad advice. The entire point of this thread is to make it work without using another service. You caved to the Goldbergian buffoonery unless there was never a clear benefit to calling Apps Script directly in the first place. :winking_face:
Share with us - what happens after you call the Integromat webhook?
BTW - while Airtable is unable to follow redirects, a well-designed webhook in Google Apps Script is perfectly capable of receiving requests and performing complex operations in a call-back process. This function works flawlessly - made almost 20,000 calls last month with not a single failure. Note how a response 302 is reimagined as a 200. :winking_face:
async function callOneMail(task, recordID)
{
const url = "https://script.google.com/macros/s/.../exec?token=12345&task=" + task + "&id=" + recordID;
let getResponse;
let getOptions = {
method: "post",
headers: {
'Accept' : 'application/json',
}
}
try {
let getResults = await fetch(url, getOptions);
getResponse = await getResults.json();
} catch (e) {
getResponse = {
"result" : "200OK",
"elapsedTime" : 0.0
}
}
return(getResponse);
}