无法找到通道,松弛反应。

发布于 2025-01-26 19:36:22 字数 2201 浏览 2 评论 0原文

我想对渠道以及Slack中的私人团体中的消息做出反应。我已经对在有效的公共渠道中发送的消息做出了反应,但是当涉及私人组时,API响应是“ channel_not_found”,尽管我正在传递正确的频道ID。我正在使用reactions.ADD方法与Slack Bolt Python。

我想知道这种方法是否根本无法与私人团体合作?有人有修复此问题的经验吗?

channel_id = body["event"]["channel"]
timestamp = body["event"]["ts"]

app.client.reactions_add(
channel=channel_id,
timestamp=timestamp,
name="hdhex",
token=context.bot_token
)
The server responded with: {'ok': False, 'error': 'channel_not_found'})
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/slack_bolt/listener/thread_runner.py", line 124, in run_ack_function_asynchronously
    listener.run_ack_function(request=request, response=response)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/slack_bolt/listener/custom_listener.py", line 50, in run_ack_function
    return self.ack_function(
  File "/Users/ryanhuang/Documents/GitHub/first-bolt-app/app.py", line 16, in react
    app.client.reactions_add(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/slack_sdk/web/client.py", line 3507, in reactions_add
    return self.api_call("reactions.add", params=kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/slack_sdk/web/base_client.py", line 145, in api_call
    return self._sync_send(api_url=api_url, req_args=req_args)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/slack_sdk/web/base_client.py", line 182, in _sync_send
    return self._urllib_api_call(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/slack_sdk/web/base_client.py", line 324, in _urllib_api_call
    ).validate()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/slack_sdk/web/slack_response.py", line 205, in validate
    raise e.SlackApiError(message=msg, response=self)
slack_sdk.errors.SlackApiError: The request to the Slack API failed. (url: https://www.slack.com/api/reactions.add)
The server responded with: {'ok': False, 'error': 'channel_not_found'}```

I would like to react to messages in channels as well as private groups in Slack. I've gotten reacting to messages sent in public channels working, however when it comes to private groups the api response is "channel_not_found" though I am passing the correct channel ID. I'm using the reactions.add method with Slack Bolt Python.

I'm wondering if this method is simply unable to work with private groups? Has anyone had experience fixing this?

channel_id = body["event"]["channel"]
timestamp = body["event"]["ts"]

app.client.reactions_add(
channel=channel_id,
timestamp=timestamp,
name="hdhex",
token=context.bot_token
)
The server responded with: {'ok': False, 'error': 'channel_not_found'})
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/slack_bolt/listener/thread_runner.py", line 124, in run_ack_function_asynchronously
    listener.run_ack_function(request=request, response=response)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/slack_bolt/listener/custom_listener.py", line 50, in run_ack_function
    return self.ack_function(
  File "/Users/ryanhuang/Documents/GitHub/first-bolt-app/app.py", line 16, in react
    app.client.reactions_add(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/slack_sdk/web/client.py", line 3507, in reactions_add
    return self.api_call("reactions.add", params=kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/slack_sdk/web/base_client.py", line 145, in api_call
    return self._sync_send(api_url=api_url, req_args=req_args)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/slack_sdk/web/base_client.py", line 182, in _sync_send
    return self._urllib_api_call(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/slack_sdk/web/base_client.py", line 324, in _urllib_api_call
    ).validate()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/slack_sdk/web/slack_response.py", line 205, in validate
    raise e.SlackApiError(message=msg, response=self)
slack_sdk.errors.SlackApiError: The request to the Slack API failed. (url: https://www.slack.com/api/reactions.add)
The server responded with: {'ok': False, 'error': 'channel_not_found'}```

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

双马尾 2025-02-02 19:36:22

要访问私人组中的任何消息,您的机器人应该是此类对话的一部分。

您能确认所讨论的机器人是该私人组的成员吗?

To access any message in a private group, your bot should be part of such conversation.

Can you confirm that the bot in question is member of that private group?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文