bots - 带有 Google Script 的 Bot Telegram - 来自 webhook 的错误响应:401 Unauthorized
问题描述
我在谷歌脚本中用这个函数设置了 webHook
function setWebhook() {
var url = telegramUrl + "/setWebhook?url=" + webAppUrl;
var response = UrlFetchApp.fetch(url);
}
其中电报 url 包含电报令牌,web AppUrl 是谷歌脚本执行 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"}}
解决方案
我遇到了同样的问题,请检查您的部署配置:以您的名字运行并允许所有人访问:
还要检查这个https://gist.github.com/manzoorwanijk/ee9ed032caedf2bb0c83dea73bc9a28e
推荐阅读
- sql - Django - 如何很好地使用过滤器和排除?
- image - Win32显示图像白色窗口问题
- java - 反序列化包含 java.lang.CharSequence 成员变量的类
- excel - 在 SQL 任务中使用 drop 和 create table 语句覆盖 Excel 目标无法正常工作。新数据正在添加为新记录
- php - PHP - 获取数组中一致的值的键
- javascript - Uncaught ReferenceError: angular is not defined 我在使用 chrome 扩展时遇到问题
- java - 使用外键查找所有约束
- javascript - jquery代码不适用于所有选择选项
- android - PerformException 错误执行单击 5dp 边距
- javascript - Laravel - 如何将 Vue 组件导入另一个组件