gpt4 book ai didi

python - 缺少来自 python 脚本的范围错误松弛消息

转载 作者:行者123 更新时间:2023-12-05 02:05:41 28 4
gpt4 key购买 nike

如果我运行以下脚本从 slack 发送消息,我会收到一个丢失的范围错误,到目前为止我无法解决!

import logging
logging.basicConfig(level=logging.DEBUG)

from slack import WebClient
from slack.errors import SlackApiError

slack_token = 'xoxb-xxxxxx-xxxxxxxx'
client = WebClient(token=slack_token)

try:
response = client.chat_postMessage(
channel="C018KGV8GHJ",
text="Hello from your app! :tada:"
)
except SlackApiError as e:
#You will get a SlackApiError if "ok" is False
assert e.response["error"] # str like 'invalid_auth', 'channel_not_found'

我收到以下错误:'ok': False, 'error': 'missing_scope', 'needed': 'chat:write:bot', 'provided': 'incoming-webhook'

脚本来自slack网页

如何解决 missing_scope 错误?

最佳答案

问题是我如何设置 slack API。我重新安装了 API:需要启用传入的 webhooks,在权限中:需要激活 Channel:Read 和 Chat:Write。还需要将 API 添加到 channel 中。之后一切正常!

关于python - 缺少来自 python 脚本的范围错误松弛消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63314630/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com