-
Notifications
You must be signed in to change notification settings - Fork 378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot post a message as a user via an application/bot #2092
Comments
Hi @jpventura, thanks for asking the question! What "chat:write.customize" scope gives to your app might be confusing, but as mentioned at slackapi/bolt-python#611, this bot scope allows your app to send a "bot" message with a personalized icon and username. This feature is supposed to be used for visualizing bot and various user interactions within a Slack thread conversation. For your use case, your app needs to serve the OAuth flow for app installation and ask each your end user to grant your app to post a message on behalf of them. More specifically, chat:write in user_scope in the OAuth flow is necessary. Behaving as a human user is so critical that your app needs to receive approval from each user to do so. I hope this helps. |
@seratch I tried exactly this call and the icon and name change does not happen. The permission was added to the bot, but it does not seems to work on new apps. |
Just in case, I verified there is no such issue with a newly created app. I create a new app and confirmed the app works for me without any issues. To narrow your issue down, I'd suggest making sure the following:
I hope this helps. |
@seratch Thank you for your attention. We discovered the problem. According to the documentation, The following code works as expected: const result = await app.client.chat.postMessage({
channel: channel_id,
icon_url: 'https://i.pinimg.com/736x/b5/13/5f/b5135f5280b8ccb7b48c0bb9eaedc158.jpg',
text: 'All your bases are belong to us',
token: process.env.SLACK_BOT_TOKEN,
username: 'CATS',
}); However it does not seem to work with |
I just checked the code and compared the
and
So I would guess that this feature is unsupported and it would require a patch into the library. |
Hi @jpventura, I overlooked you were trying to use as_user option, but you're right that the option should not be used along with username and icon for the latest permission. As for files.upload API, it does not support the parameters. However, you can do the following instead:
I hope this helps. |
👋 It looks like this issue has been open for 30 days with no activity. We'll mark this as stale for now, and wait 10 days for an update or for further comment before closing this issue out. If you think this issue needs to be prioritized, please comment to get the thread going again! Maintainers also review issues marked as stale on a regular basis and comment or adjust status if the issue needs to be reprioritized. |
(Filling out the following with as much detail as you can provide will help us solve your issue sooner.)
Reproducible in:
The Slack SDK version
(Paste the output of)
or refer to your
package.json
Node.js runtime version
OS info
Ubuntu 22.04.4 LTS
v13.6.4
(Paste the output of
sw_vers && uname -v
on macOS/Linux orver
on Windows OS)Steps to reproduce:
Same issue was reported at
bolt-python
when trying to use Bolt to post a channel message an specific user:Expected result:
Bolt Slack bot should post a message by the specified username and with a different profile picture,
Actual result
As reported at
bolt-python
, this feature is not working at their framework, neitherbolt-js
.What the chat:write.customize scope enables developers is to customize the message appearance (icon, name) while the message is still by a bot user.
If your situation here is that the username argument for a customized bot message does not work as you expect, please let us know. We'll try to reproduce the situation on our end.
I also does not work at
chat.postMessage
test page.I would recommend modify the API to use the
user_id
instead ofusername
, considering the last one may be changed.The text was updated successfully, but these errors were encountered: