-
Notifications
You must be signed in to change notification settings - Fork 395
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
Getting started interactive message example does not work. #163
Comments
I've been able to reproduce this issue with a simple button block action. Here is my code: const { App } = require('@slack/bolt');
const app = new App({
token: process.env.SLACK_BOT_TOKEN,
signingSecret: process.env.SLACK_SIGNING_SECRET,
});
app.message('hello', ({ say }) => {
say({
blocks: [{
type: 'section',
text: {
type: 'mrkdwn',
text: 'You can add a button alongside text in your message. ',
},
accessory: {
type: 'button',
action_id: 'foo',
text: {
type: 'plain_text',
text: 'Button',
emoji: true,
},
value: 'click_me_123',
},
}],
});
});
app.action('foo', ({ ack }) => {
console.log('action listener called');
ack();
});
(async () => {
const server = await app.start(process.env.PORT || 3000);
console.log('⚡️ Bolt app is running!', server.address());
})(); Here is the output:
Notice that the We had an issue with block action (or interactive message) detection. Specifically, the incoming action (potentially a block action, interactive message, dialog submission, or message action) is supposed to go through the following function, which is supposed to detect whether its of the two types we're trying to identify. In this case, this detection gives us the wrong answer. The This is the kind of issue that TypeScript's typechecker is supposed to help us ensure that it doesn't happen. It's the reason we went through a lot of effort to write types for all these objects. However, in this case we defeated ourselves by leaving many objects "open ended", using the I'm starting to think that we should remove |
We just published |
Great work @shanedewael, @aoberoi. Much appreciated! I saw you also fixed the
|
@sfroestl wow... thank you.. @shaydewael you guys should really consider upgrading the documentation. Just spent 3 hours trying to figure out how do I get the user details in the action payload. Had hacked it out by attaching the user id I found from the command via context until I came across the |
I also just spent an hour trying to get the user that clicked a button, couldn't see any documentation that showed how to get the payload of the block_action, only the payload of the action which doesn't have the user data. Maybe I missed it, it's possible, but this comment just saved me 🙏 |
@MattB543 sorry about that! You are totally right that we don't have a section in our docs for this. We hope to add some reference docs to tackle this soon. We do have a section in the readme for it over at https://github.com/slackapi/bolt-js#making-things-happen |
Description
Hey!
First, thanks for the great project. 🚀
I've tried the getting started interactive message example but I can't make it work so that the
button_click
listener is invoked. See the code here https://github.com/sfroestl/bolt-example/blob/master/src/app.jsI've configured both
Interactive Components
andEvents API
of my slack app to point to/slack/events
.The message listener works fine.
https://slack.dev/bolt/tutorial/getting-started
What type of issue is this?
Requirements
Bug Report
Filling out the following details about bugs will help us solve your issue sooner.
Reproducible code in:
https://github.com/sfroestl/bolt-example
package version: 1.0.0
node version: v10.15.1
OS version(s): MacOs 10.14.4
Steps to reproduce:
$ npm i && npm start
Expected result:
Callback to be executed.
Actual result:
The handler is not executed
Thanks a lot for your help!
The text was updated successfully, but these errors were encountered: