node.jsexpressslack-apislack-block-kitslack-dialog

Can't open modal using `trigger_id` from Slash Command in Slack Bot


My goal is to trigger modal open using Slack slash command. I got the trigger_id from the slash command in my slack app, and trying to open modal using it, but getting following error though I can see valid trigger_id in my console logs.

Error in trigger handler Error: An API error occurred: invalid_trigger_id

Solution

  • This is because of my bad. I used push method instead of open method to open modal. It is working after changing my code like this:

    await bot.api.views.open({
        trigger_id: triggerId //You can get from slash command payload,
        view: view // this is the modal content view
    })