Slack not_allowed_token_type 错误 - 如何在命令行上发送消息

us2*_*956 7 curl slack-api slack slack-commands

我创建一个应用程序,然后单击“安装到工作区”。我选择频道。[![在此处输入图像描述][1]][1]

我生成应用程序级别令牌

[![在此处输入图像描述][2]][2]

然后我根据命令使用

curl https://slack.com/api/conversations.list -H "Authorization: Bearer xapp-1-A0xxx"
Run Code Online (Sandbox Code Playgroud)

它返回

{"ok":false,"error":"not_allowed_token_type"}
Run Code Online (Sandbox Code Playgroud)

我该如何修复?如何向频道或用户发送消息?[1]: https://i.stack.imgur.com/sA5aM.png [2]: https://i.stack.imgur.com/Zy8oz.png

san*_*dra 10

您使用了错误的承载令牌。您应该使用机器人令牌 (xoxb)。您当前使用的令牌仅供套接字模式使用。确保该conversations.list方法具有正确的范围,并且在安装应用程序后,您应该在 OAuth 和权限页面中看到机器人令牌。