微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

添加了 Slack API 范围 (groups:history) 但仍然缺失

如何解决添加了 Slack API 范围 (groups:history) 但仍然缺失

我想构建一个可以检索频道聊天历史记录的 Slack 机器人,但即使我已经添加了它,我也面临 missing_scope 错误消息:

Error creating conversation: The request to the Slack API Failed.
The server responded with: {'ok': False,'error': 'missing_scope','needed': 'groups:history','provided': 'identify,bot:basic'}

我检查了我的 App/OAuth&Permissions 并添加了 groups:history 范围(附上图片),但我仍然面临这个问题。我的应用具有以下范围:“bot”、“channels:history”、“chat:write:bot”、“groups:history”、“im:history”、“mpim:history”。

Scope Sceenshot

我的代码只是调用了对话历史 API。服务器/客户端连接一切正常,因为我可以执行其他 API 调用,例如 chat_postMessage。

try:
    result = await web_client.conversations_history(channel=channel_id,latest=from_sse,oldest=to_sse)

    conversation_history = result["messages"]

    print("{} messages found in {}".format(len(conversation_history),id))

 except SlackApiError as e:
    print("Error creating conversation: {}".format(e))

有什么想法吗?提前致谢!

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。