I set webHook with this function in google script
function setWebhook() {
var url = telegramUrl + "/setWebhook?url=" + webAppUrl;
var response = UrlFetchApp.fetch(url);
}
where telegram url contains telegram token and web AppUrl is google script exec url.
When i try to get webhook info with funtion
function getWebhookinfo() {
var url = telegramUrl + "/getWebhookInfo";
var response = UrlFetchApp.fetch(url);
Logger.log(response.getContentText());
}
I receive this error message:
[20-12-22 10:41:23:115 CET] {"ok":true,"result":{"url":"https://script.google.com/macros/s/___________________________/exec","has_custom_certificate":false,"pending_update_count":0,"last_error_date":1608570964,"last_error_message":"Wrong response from the webhook: 401 Unauthorized","max_connections":40,"ip_address":"172.217.17.78"}}
2
Answers
I had the same problem, please check you deployment config: run by your name and allow access to everyone:
Also check this https://gist.github.com/manzoorwanijk/ee9ed032caedf2bb0c83dea73bc9a28e
I also encountered this problem. This ( image ) is the correct configuration. 401 Unauthorized means it does not get access to your Google account. There is a button after you set the previous configuration to ask for the authority.