【问题标题】:Bot Telegram with Google Script- Wrong response from the webhook: 401 Unauthorized带有 Google Script 的 Bot Telegram - 来自 webhook 的错误响应:401 Unauthorized
【发布时间】:2021-09-26 10:09:59
【问题描述】:

我在 google 脚本中用这个函数设置了 webHook

function setWebhook() {
var url = telegramUrl + "/setWebhook?url=" + webAppUrl;
var response = UrlFetchApp.fetch(url);
}

其中电报 url 包含电报令牌,web AppUrl 是 google script exec url。 当我尝试使用功能获取 webhook 信息时

function getWebhookinfo() {
var url = telegramUrl + "/getWebhookInfo";
var response = UrlFetchApp.fetch(url);
  Logger.log(response.getContentText());
}

我收到此错误消息:

[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"}}

【问题讨论】:

    标签: bots telegram unauthorized


    【解决方案1】:

    我遇到了同样的问题,请检查你的部署配置:以你的名字运行并允许所有人访问:

    也可以查看https://gist.github.com/manzoorwanijk/ee9ed032caedf2bb0c83dea73bc9a28e

    【讨论】:

      【解决方案2】:

      我也遇到过这个问题。这(image)是正确的配置。 401 Unauthorized 意味着它无法访问您的 Google 帐户。设置了之前的配置后,有一个按钮可以请求权限。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-04-21
        • 1970-01-01
        • 2020-08-14
        • 2016-07-15
        • 2019-06-26
        • 1970-01-01
        • 1970-01-01
        • 2016-03-12
        相关资源
        最近更新 更多