Slack Shortcut not working in my Bolt integration

Viewed 240

I'm using this code snippet from the documentation to acknowledge a shortcut button click

app.shortcut('create-engagement', async ({ shortcut, ack, client }) => {

  try {
    // Acknowledge shortcut request
    await ack();

    // Call the views.open method using one of the built-in WebClients
    const result = await client.views.open({
      trigger_id: shortcut.trigger_id,
      view: {
        type: "modal",
        title: {
          type: "plain_text",
          text: "My App"
        },
        close: {
          type: "plain_text",
          text: "Close"
        },
        blocks: [
          {
            type: "section",
            text: {
              type: "mrkdwn",
              text: "About the simplest modal you could conceive of :smile:\n\nMaybe <https://api.slack.com/reference/block-kit/interactive-components|*make the modal interactive*> or <https://api.slack.com/surfaces/modals/using#modifying|*learn more advanced modal use cases*>."
            }
          },
          {
            type: "context",
            elements: [
              {
                type: "mrkdwn",
                text: "Psssst this modal was designed using <https://api.slack.com/tools/block-kit-builder|*Block Kit Builder*>"
              }
            ]
          }
        ]
      }
    });

    console.log(result);
  }
  catch (error) {
    console.error(error);
  }
});

But I'm receiving the following error

[ERROR]  bolt-app An incoming event was not acknowledged within 3 seconds. Ensure that the ack() argument is called in a listener.

My Request URL is the same as my working Event Subscription request URL with /slack/events at the end of the URL.

The above "create-engagement" in the listener is my Callback ID setup in the shortcuts section.

Any ideas?

0 Answers
Related