Open asportnoy opened 1 month ago
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 support@slack.com
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.
(Filling out the following with as much detail as you can provide will help us solve your issue sooner.)
Packages:
Select all that apply:
@slack/web-api
@slack/rtm-api
@slack/webhooks
@slack/oauth
@slack/socket-mode
@slack/types
Reproducible in:
The Slack SDK version
v7.3.1
Node.js runtime version
v20.12.2
OS info
Steps to reproduce:
Expected result:
All 3 messages should send using my profile since
as_user
is enabledActual 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.
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.