Bolt-js: Button action listener not being called - Interactive message not working

Created on 18 Apr 2020  路  4Comments  路  Source: slackapi/bolt-js

Description

Unable to listen to button actions in my bolt app but able to listen to events.

I have setup request URL for interactivity and shortcuts.

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 (place an x in each of the [ ])

  • [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.

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

Reproducible in:

package version: @slack/bolt => 2.0.1

node version: v12.16.1

OS version(s): Mac OS

Steps to reproduce:

Code as same mentioned in the website.

// Listens to incoming messages that contain "hello"
app.message('hello', async ({ message, say }) => {
  // say() sends a message to the channel where the event was triggered
  await say({
    blocks: [
      {
        "type": "section",
        "text": {
          "type": "mrkdwn",
          "text": `Hey there <@${message.user}>!`
        },
        "accessory": {
          "type": "button",
          "text": {
            "type": "plain_text",
            "text": "Click Me Button"
          },
          "action_id": "button_click"
        }
      }
    ]
  });
});

__Button Listener__

app.action({ action_id: 'button_click' },
  async ({ action, ack, context }) => {
    await ack();
    try {
      const result = await app.client.reactions.add({
        token: context.botToken,
        name: 'white_check_mark',
        timestamp: action.ts,
        channel: action.channel.id
      });
    }
    catch (error) {
      console.error(error);
    }
  });

Expected result:

The action listener has to be invoked.

Actual result:

No events fired in the Bolt app.

What actually happened
I see the following in ngrok POST /slack/actions 404 Not Found

Attachments:

Screen Shot 2020-04-18 at 9 32 13 PM

Screen Shot 2020-04-18 at 9 32 23 PM

Logs, screenshots, screencast, sample project, funny gif, etc.

question

Most helpful comment

馃憢 Bolt framework receives all kinds of events with the path /slack/events and properly dispatch them for you. Set the /slack/events also for the Request URL in the Interactivity section.

All 4 comments

馃憢 Bolt framework receives all kinds of events with the path /slack/events and properly dispatch them for you. Set the /slack/events also for the Request URL in the Interactivity section.

Thank you so much for the quick reply. IT WORKED 馃ぉ.

It would have been good if the document has some reference mentioning, about the URLs to use for events and interactivity. Spent close to 4 hours yesterday. Thanks again @seratch !!!!

I'm happy to know that 馃槃 Enjoy Slack app development!

Thanks @seratch

Was this page helpful?
0 / 5 - 0 ratings

Related issues

theomelo picture theomelo  路  3Comments

dschinkel picture dschinkel  路  4Comments

selfcontained picture selfcontained  路  4Comments

TK95 picture TK95  路  3Comments

jamesfmac picture jamesfmac  路  5Comments