Button presses handler never gets triggered
Description
Hello! As the title suggests, I'm having a hard time making it work. I have this code:
This servers as a '/slack' path router, where I would like your package to take care of the interactive route.
...
const router = Express.Router()
router.use(bodyParser.json())
router.use(bodyParser.urlencoded({ extended: true }))
router.get('/oauth/login', oauth.login)
router.get('/oauth/callback', oauth.callback)
router.use('/interactive', interactionsAdapter)
export default router
...
...
app.use('/slack', slackRouter)
...
The interactions adapter looks like follow:
import { createMessageAdapter } from '@slack/interactive-messages'
// Create the adapter using the app's signing secret, read from environment variable
const slackInteractions = createMessageAdapter(process.env.SLACK_CLIENT_SECRET)
slackInteractions.action({ type: 'button' }, (payload, respond) => {
console.log(payload)
const reply = payload.original_message
return reply
})
// Attach the adapter to the Express application as a middleware
// NOTE: The path must match the Request URL and/or Options URL configured in Slack
export default slackInteractions.expressMiddleware()
But no matter what I type into the .action parameters, the function never gets triggered with the press of the button. I tried setting up callback_ids and other filters described in the situation, but it still never gets run. I'm not that experienced developer, so the error is most likely on my side, but I'm not sure where to look.
I've double checked what I'm getting from the slack servers and everything seems to be ok.
Thank you
EDIT:
When running the whole thing with ngrok, it is giving me errors like POST /slack/interactive 500 Internal Server Error but the express application itself is not printing out anything.
What type of issue is this? (place an x in one of the [ ])
- [ ] bug
- [ ] enhancement (feature request)
- [X] question
- [ ] documentation related
- [ ] testing related
- [ ] discussion
Requirements
- [X] I've read and understood the Contributing guidelines and have done my best effort to follow them.
- [X] I've read and agree to the Code of Conduct.
- [X] I've searched for any related issues and avoided creating a duplicate issue.
hi @rojcyk, thanks for providing such a complete description of your code and the issue.
my first step in debugging this would be to... enable debugging! Something which we should have documented a long time ago (see: #29).
In short, you need to start your application with the environment variable DEBUG=@slack/interactive-messages:*. If you do that, you should get logs printed to the console. If you send us these logs here, we can try and figure out why the handler isn't matching with the action.
Hey @rojcyk, I'm closing this issue out since it's been a few months since the latest response. Hopefully you figured it all out! If you are still facing a problem, feel free to open a new issue at https://github.com/slackapi/node-slack-sdk/issues (we've moved this project there).