Unfurl uploaded image does not work
reisenmachtfreude opened this issue · 1 comments
Uploading and sharing an image does only work partially:
The message is created in the channel. The linked title shows the picture if I click it.
However, the picture itself is not shown directly in the message as well as the private file is not listed as "shared file" in the slack web interface. Instead it is listed as private file and I can share it manually which works fine.
I'm using the following code:
_self.slack = Slacker()
...
res = _self.slack.files.upload(filename,channels=_self.slack.channels.get_channel_id('#general'))
resParsed = json.loads(str(res))
url = resParsed["file"]["url_private"]
attachments = [{"title": "Overview", "title_link": url, "text":"test", "image_url":url}]
_self.slack.chat.post_message("#general", "Overview",as_user=True, attachments=attachments)
Please help.
After endless tries my conclusion is that there must be a bug.
I've solved the problem by switching to https://github.com/slackapi/python-slackclient
Here the issue was solve within a minute, because I only need to upload the file
slack.api_call('files.upload', channels='#general', filename='pic.png', file=open(filename, 'rb'))
In the slack channel the new upload is mentioned automatically and it's content is unfurled.