-
Notifications
You must be signed in to change notification settings - Fork 379
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
Message.respond doesn't work for message actions #106
Comments
Hi @TK95, can you try v3.2.1 and confirm the issue is resolved? This is what I tested with BTW:
|
Hey, @mbrevoort and thanks for looking into it! I installed v3.2.1 and did tests. Your snippet works just fine! Please, consider the following code: const middlewareFn = (msg, next) => {
return msg.respond({
text: ':tada: Hello from middleware',
response_type: 'ephemeral'
})
}
bot.use(middlewareFn)
bot.messageAction('my_action', (msg) => {
return msg.respond({
text: ':tada: Hello from message action handler',
response_type: 'ephemeral'
})
}) The aforementioned code is very similar to my real one (Sorry I can't disclosure it). And this code doesn't work as expected. If I trigger the message action I expect that "Hello from middleware" will be posted to the channel, but nothing is happening. Please, see the second code fragment: const middlewareFn = (msg, next) => {
return msg.respond({
text: ':tada: Hello from midllware',
response_type: 'ephemeral'
})
}
// bot.use(middlwareFn)
bot.messageAction('my_action', middlewareFn, (msg) => {
return msg.respond({
text: ':tada: Hello from message action handler',
response_type: 'ephemeral'
})
}) In this example, I commented out Are there any problems with using middlewares in message actions? I tried to add a callback argument, like this If you need any other details, please let me know. |
I think what may be causing the behavior you're seeing is that For some context, You could probably accomplish what you want in a few ways. Slack added an api to postEphemeral - which is a way to create an ephemeral message outside having to respond to an event request. You could make that api call either in your middleware, or from within your |
Fix coming. With this fix |
@TK95, v3.2.2 should fix the problem. Just make sure you call |
Thanks, @mbrevoort and @selfcontained. Everything works like a charm! |
Greetings.
I've faced the issue related to message actions, looks like Message.respond doesn't do anything when I'm inside in message action handler.
Steps to reproduce:
msg.respond('Some text')
and notice that actually nothing is happening (The message hasn't been posted in the channel).Additional info:
Any questions let me know.
The text was updated successfully, but these errors were encountered: