'Problem with posting files to slack channel using Python
So I need to send messages and post files to slack channels using Python.
I am able to send messages but I am getting error uploading files. The relevant piece of code looks likes this:
response = self.client.chat_postMessage(
channel='#notifications',
text=message)
filepath=f'./{file_name}'
response = self.client.files_upload(
channels='#notifications',
file=filepath)
The message gets posted successfully, the file upload results in error:
slack.errors.SlackApiError: The request to the Slack API failed.
The server responded with: {'ok': False, 'error': 'not_in_channel'}
I have set the following permission in Slack OAuth and permissions screen:
incoming-webhook, chat:write, chat:write.public, files:write
I know that if I dont give chat:write.public I get same error while posting messages as well. However I am not able to find any files:write.public permission.
Has anyone encountered this error? Any insight is appreciated.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
