node-slack-sdk icon indicating copy to clipboard operation
node-slack-sdk copied to clipboard

What is the maximum size of the icon_url in chat.postMessage ?

Open 75asa opened this issue 4 years ago • 7 comments

(Describe your issue and goal here)

I tried chat.postMessage() w/ icon_url. Sometimes I noticed that the icon_url option is not working! So, I checked the size of the file specified in icon_url, and found that SlackApp can't wrap the icon as icon_url if it's 2.7 MB. So I'd like to know the maximum size that can be specified for icon_url. If it's in the documentation, I'd appreciate it if you could tell me. Thanx.

Packages:

Select all that apply:

  • [x] @slack/web-api
  • [ ] @slack/rtm-api
  • [ ] @slack/webhooks
  • [ ] @slack/oauth
  • [ ] @slack/socket-mode
  • [ ] I don't know

Reproducible in:

The Slack SDK version

6.4.0

Python runtime version

v16.4.0

OS info

MacOS Big Sur 11.6

Steps to reproduce:

(Share the commands to run, source code, and project settings)

2. 3.

Expected result:

(Tell what you expected to happen)

Actual result:

(Tell what actually happened with logs, screenshots)

Requirements

For general questions/issues about Slack API platform or its server-side, could you submit questions at https://my.slack.com/help/requests/new instead. :bow:

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

75asa avatar Dec 17 '21 11:12 75asa

Hi @75asa, thanks for asking the question!

Sometimes I noticed that the icon_url option is not working!

Can you elaborate more on this? What actually happens in the case? Does chat.postMessage API call fail? Or isn't the icon_url used for the posted message?

seratch avatar Dec 17 '21 12:12 seratch

Thanx for triaging my issue @seratch ! Yup, This use case looks like the following

When a user icon registered in Notion is posted to Slack, the icon_url option in chat.postMessage is enabled, and it acts as if it was posted by a Notion user (To add, the Notion user icon is a public URL)

Many user icons had the icon_url option enabled However, I noticed that some of the Notion user icons were not using the icon_url option and were displaying the SlackApp icon itself. (The post itself was successful.)

So I checked the logs and performance, but I didn't see any errors, so I thought I decided to check the size of the image specified in the Notion user icon.

I noticed that it was failing with a 2.7MB jpeg. I also noticed that photos with Japanese in the file name failed as well.

So, back to my original question, I raised this issue because I wanted to know if there is a limit to the number of images that can be specified as icon_url in chat.postMessage.

75asa avatar Dec 21 '21 01:12 75asa

@75asa Thanks for your reply. As far as I know, there is no specific size limitation on the icon data as of today. That being said, if loading an image takes long, Slack may skip using the specified image for the message for safety and stable behavior. I would recommend making a smaller image data by using image size reducer (say, a proxy server to convert the original image to a manageable one).

I hope this helps.

seratch avatar Dec 21 '21 01:12 seratch

@seratch Thx for your speedy reply and the advice 🥳 I'm going to try that method, Thanks !!

75asa avatar Dec 21 '21 02:12 75asa

Thanks for your reply! Let us close this issue now.

seratch avatar Dec 21 '21 02:12 seratch

I've recently seen the custom image from icon_url being loading in the desktop app, but not in mobile. I've seen it in more than one Slack App. I've tried with smaller images too, but no luck.

This worked previously also in the mobile app. Is it a known issue? or something intended that's not documented?

serbixote avatar Dec 15 '24 03:12 serbixote

Not sure if this will solve your issue, but hopefully this will help anyone else looking for icon_url and or username not working with chat.postMessage.

Need to add scope chat.write.customize to your App. I was fighting with this for a while today and after searching and not finding a solution (did see it mentioned anywhere in the slack documentation either), I found this extra scope for this in my app settings.

Hope this helps someone.

thelonewolf avatar Sep 24 '25 21:09 thelonewolf