'Unable to Find Channel, Slack reactions.add Method
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'}```
Solution 1:[1]
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?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Suyash Gaur |