Skip to content
This repository has been archived by the owner on Jul 3, 2020. It is now read-only.

Unfurl uploaded image does not work #121

Open
reisenmachtfreude opened this issue Oct 21, 2017 · 1 comment
Open

Unfurl uploaded image does not work #121

reisenmachtfreude opened this issue Oct 21, 2017 · 1 comment

Comments

@reisenmachtfreude
Copy link

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.

@reisenmachtfreude
Copy link
Author

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.

@reisenmachtfreude reisenmachtfreude changed the title Share uploaded image does not work Unfurl uploaded image does not work Oct 29, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant