我试图创建一个非常简单的Slack使用僵尸工具包和谷歌应用引擎,但出于某种原因,我不断得到401错误,每次我给机器人。奇怪的是,Slack事件订阅URL (以/api/messages结尾的URL)验证正确,我在GAE日志中获得了200个响应,并在Slack中进行了验证。
但是每当我给机器人发信息的时候,它总是得到一个401错误,根本没有解释错误的信息。我已经尝试了下面的各种代码组合,现在已经将其剥离到最低限度,就像找到了这里一样。除了依赖项和解密凭据的代码(我已经验证了该代码正在按预期工作)之外,目前这是我的完整代码:
botInit();
async function botInit () {
const credentialsRaw = await getCredentials();
const credentials = JSON.parse(credentialsRaw);
const adapter = new SlackAdapter(credentials);
const controller = new Botkit({
adapter: adapter
});
controller.on('message', async(bot, message) => {
await bot.reply(message, 'I heard a message!');
});
}我还在消息传递函数中尝试过这样的方法:
controller.ready(() => {
controller.hears(['hello', 'hi'], ['message', 'direct_message'],
async (bot, message) => {
await bot.reply(message, 'Meow. :smile_cat:')
})
})这个用于设置控制器:
const controller = new Botkit({
webhook_uri: '/api/messages',
adapter: adapter
});所有内容都会返回相同的401错误,尽管所有这些错误都与Slack上的事件订阅URL验证有关。
发布于 2020-10-07 10:41:48
我也有同样的问题,但我想出了问题。
我一直使用clientSigningSecret的客户端机密
但是我应该使用签署秘密!

https://stackoverflow.com/questions/64178676
复制相似问题