一直在尝试在 Google Sheets Apps 脚本中设置一个 Webhook,该脚本将在 Trello 中进行更改时做出响应。为此,建议将脚本部署为 Web 应用程序(需要返回 HTML 的doGet函数)以创建用于接收和请求doPost的 URL 目标。postget
Web 应用程序创建两个 URL,一个以 结尾/dev并用于开发目的(不响应post请求),另一个以 结尾/exec用于正常访问。
我已经部署了 Web 应用程序,两个 URL 都可以在我的浏览器中访问和响应(可以在不登录的情况下以隐身方式查看 exec),应用程序发布为以“我”身份执行,并且可以由“任何人,甚至匿名”访问。
我已经能够成功使用下面的代码为/devURL 创建网络挂钩,但不是/execURL。
function create() {
var url = 'https://api.trello.com/1/tokens/ae6ebe60b45abcd2d4aa945c9ab4c4571bd6b6f7856b1df0cd387fbffc649579/webhooks/?key=a211f4aca7fb3e521d652730dd231cb6'
var payload = {
"key": "xxxxxxxxxxx",
"token" : "xxxxxxxxxxxxx",
"callbackURL": "https://script.google.com/macros/s/AKfycbw51TYGWHe95hKdcAs4l7E2eg0AtBi8e48lf_iafKYI/dev",
"idModel":"xxxxxxxx",
"description": "GW Test"
}
var options = {"method" : "post",
"payload" : payload,
"muteHttpExceptions": true
};
var response …Run Code Online (Sandbox Code Playgroud)