Search code examples
slack-apislack

Slack image_url not public


I want to send an url image (as preview) on post message. The "image-server" is private and is accessible only via LAN and don't require auth.

I try to push this json

{"text": "Example Message", "attachments": [{"title": "Example message","text": "...","image_url": "http://192.168.0.100:5000/preview/myimg.jpg" }] }

... and not work.

I want to see the preview (on slack) when i'm on LAN network.

How i can do that?

Thanks


Solution

  • This can not work. Slack is on the Internet and not able to access a server on your private LAN, which is apparently behind a firewall / NAT router (as the IP address suggests).

    If you want Slack to show images from your local image server you need to open it to the Internet, so that Slack can get access to the server.

    There are many ways on how to do that, e.g. most routers provide a feature that opens access to local servers from the Internet. However, that would also open your local network for potential attacks from the Internet, so I that risk needs to be considered when evaluating this option.

    If you image server is a PC a more secure way for opening it to the Internet (and Slack) is to use a VPN tunnel like ngrok. That is btw. also the recommended approach in the official Slack tutorial for connecting a local development machine with Slack.