`reply_broadcast` does not send as user even if `as_user` is enabled
(Filling out the following with as much detail as you can provide will help us solve your issue sooner.)
Packages:
Select all that apply:
- [x]
@slack/web-api - [ ]
@slack/rtm-api - [ ]
@slack/webhooks - [ ]
@slack/oauth - [ ]
@slack/socket-mode - [ ]
@slack/types - [ ] I don't know
Reproducible in:
The Slack SDK version
v7.3.1
Node.js runtime version
v20.12.2
OS info
ProductName: macOS
ProductVersion: 14.5
BuildVersion: 23F79
Darwin Kernel Version 23.5.0: Wed May 1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000
Steps to reproduce:
// Using the "User OAuth Token" from the "OAuth & Permissions" tab
export const slack = new WebClient('TOKEN');
const channel = 'YOUR CHANNEL ID HERE';
const message = await slack.chat.postMessage({
channel,
as_user: true,
text: 'testing',
});
await slack.chat.postMessage({
channel,
thread_ts: message.ts!,
as_user: true,
text: 'testing',
});
await slack.chat.postMessage({
channel,
thread_ts: message.ts!,
as_user: true,
text: 'testing two',
reply_broadcast: true,
});
Expected result:
All 3 messages should send using my profile since as_user is enabled
Actual result:
The first two messages sent as my profile, but the one with reply_broadcast enabled sent as the app and not my profile.
I also tried to send a message and then update it as a workaround, but it turned into the application as soon as I tried to update it.
const message = await slack.chat.postMessage({
channel,
as_user: true,
text: 'testing',
});
const threadMsg = await slack.chat.postMessage({
channel,
thread_ts: message.ts!,
as_user: true,
text: 'testing',
});
await slack.chat.update({
ts: threadMsg.ts!,
channel,
reply_broadcast: true,
});
PS: TypeScript considers that last one to be an invalid type even though it doesn't seem to be invalid. Might want to fix that.
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.
Hi @asportnoy thanks for writing in 💯
Have you tried setting as_user=True for the chat.update request?
It should be something like this
await slack.chat.update({
channel,
ts: threadMsg.ts!,
as_user: true,
reply_broadcast: true,
});
Thanks for the suggestion @WilliamBergamin, unfortunately no dice there. Still turns into the app user when updating.
I suspect this is a bug in the slack API as it happens with the GO SDK as well.
Yes from my testing this appear to be a bug with the slack API
The following also leads to this strange behavior
const message = await client.chat.postMessage({ channel: "C123", as_user: true, text: "testing" })
const threadMsg = await client.chat.postMessage({
channel: "C123",
thread_ts: message.ts,
as_user: true,
text: 'testing',
reply_broadcast: true
});
I'll raise this internally but anyone encountering this issue can report it through /feedback command or [email protected]
If I were to guess it's probably the API code that takes the message and clone/updates it to post in two places with those nice links. Probably not passing the as_user to the update API call. This is suggested to me as my BOT is showing messasge_update events being sent out
👋 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.
unstale please
(I do understand this could be confusing but) the as_user parameter is a legacy parameter, which works only for classic Slack apps.
(Legacy) Pass true to post the message as the authed user instead of as a bot. Defaults to false. Can only be used by classic Slack apps. See authorship below. https://api.slack.com/methods/chat.postMessage#arg_as_user
The classic apps are no longer available for newly created apps for a while. Thus, you cannot use this parameter anymore. This document page https://api.slack.com/methods/chat.postMessage#arg_as_user should emphasize this much more, so I will ask the document team to update it.
If you want to customize the icon and user name, you can use chat:write.customize scope. With this permission, your chat.postMessage API call can include icon_url etc. With that being said, when you post a message using chat:write.customize, the message is still by your app's bot user, not a human. Please refer to https://github.com/slackapi/bolt-python/issues/611#issuecomment-1058546115 too.
I hear this could be inconvenient and confusing, but my answer here clarifies things for you all.
👋 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.
As this issue has been inactive for more than one month, we will be closing it. Thank you to all the participants! If you would like to raise a related issue, please create a new issue which includes your specific details and references this issue number.