


Imgur) and then use approach B.Engaging your employees is more essential than ever, and can be especially challenging in a remote team. If you need to stick with webhooks as it appears from your comments and have no access to the Slack API I would suggest uploading the image to an image hoster (e.g. Step 3 - Send messageįinally compose your message with the image URL either as Image Block or in a secondary attachment and submit it using a method of your choice.ĪPI method: chat.PostMessage or any other method for sending message incl. The other parameters you can get from your file object. So you just need to extract the pub_secret from _public and you should be able to construct the direct link to the image. The website link you get from _public has the format:

Next you need to construct the direct image link from the link to website / _public property of the file. Only then will it be accessible through its public_url propertyĪPI method: files.sharedPublicURL with the file ID as argument. Next you have to mark the uploaded file as public. Don't include the channels argument or the image will be posted visible into those channel. Step 1 - Upload image to SlackĪPI method: files.upload with no special arguments, but make sure to get the file ID from the response. Imgur) even your own webserver, as long as you get a public URL for your image file. In our example we will use Slack as image hoster, but you can use any image hoster (e.g. This only works with a public URL to your image file, so you first need to upload your image to an image hoster (which can be your Slack workspace) to get the public URL. Post message with image block / attachmentĪlternatively you can add an image to your normal message either as image block or secondary attachment. channels: ID of one or multiple channel for the image to appear inī.This is the easiest approach, however you comment is limited to one string.ĪPI method: files.upload with these arguments: Within that request you can also add a comment that will appear as message above the images. You can upload an image directly to Slack and share it in a channel. There are two different approaches on how to post a Slack message with an image.
