I want to connect webhook to google sheet via google apps script. Previously, it helped to set up the deployment of a web application for everyone runing and the webhook was connected. Now throws an error.
{
"message": "URL (https://script.google.com/macros/s/.../exec) did not return 200 status code, got 302",
"error": "VALIDATOR_URL_RETURNED_ERROR"
}
Code to connect i use before:
let webAppUrl = "https://script.google.com/macros/s/.../exec";
let spreadSheetId = "...";
let trelloKey = "...";
let trelloToken = "...";
let trelloBoard = "..."; // Board
function setWebhookTrello() {
let data = {
'key': trelloKey,
'token': trelloToken,
'callbackURL': webAppUrl,
'idModel': trelloBoard,
};
const params = {
'method': 'POST',
'contentType': 'application/json',
'payload': JSON.stringify(data)
}
UrlFetchApp.fetch('https://api.trello.com/1/webhooks?', params);
}
When i try to connect webhook with another URL (like https://webhook.site/) - working correct
I see this - How to create webhook from Google Apps Script using the "exec" url rather than "dev" url. Exec returns 403 Error but now it dont work =(
I experienced the exact same issue. The only workaround I came up with was to make a simple Google Cloud Function "relay" that receives the POST request and returns a 200 response, then passes that request body to the Google Apps Script web app. Here is an example of the GCF: