Multiple attachment with single callback_id: slack interactive component

白昼怎懂夜的黑 提交于 2019-12-11 07:29:17

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/47677066/multiple-attachment-with-single-callback-id-slack-interactive-component

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!