Search code examples
apiintegrationinteractiveslackslack-api

Multiple attachment with single callback_id: slack interactive component


Is it possible to have multiple menu attachment and allow users to select each menu before sending back the collated response?

 return Promise.resolve({
  text: `Rate each game`,
  attachments: [
    ...games.map(game => ({
      color: "#5A352D",
      title: game,
      callback_id: "game:done",
      actions: [
        {
          name: "done",
          text: "Select a score",
          type: "select",
          value: "game:done",
          options: [
            { text: 1, value: 1 },
            { text: 2, value: 2 }
          ]
        }
      ]
    }))
  ]
});

This images shows how it renders But, I need to call the callback only when the user has finished scoring each game.

Perhaps, I can provide an additional button for that, but how can I handle callback for these menu actions


Solution

  • Choosing a menu option will always fire a request to your app. But you could replace the former message and recreate the menu list each time and show the remaining menus to the user until all are chosen. Technically it will be a new message each time, but by replacing the old message the user will not notice.