1

I am trying to get all the values from all actions. Currently I have two select actions (Pick a game and Pick a day). In the interactive_messages_callback I am getting the selected value only of the currently modified select.

Is there a way to get an array of values from all the actions like currentValues: [ os_type_selection: 'osx', day_selection: '2' ]?

bot.reply(message, {
  attachments: [
    {
      title: 'Question 1',
      callback_id: 'question_1',
      attachment_type: 'default',
      actions: [
        {
          name: 'os_type_selection',
          text: 'Pick a game...',
          type: 'select',
          options: [
            {
              text: 'Mac OS X',
              value: 'osx',
            },
            {
              text: 'Windows',
              value: 'windows',
            }
          ]
        }
      ],
    },
    {
      title: 'Question 2',
      callback_id: 'question_2',
      attachment_type: 'default',
      actions: [
        {
          name: 'day_selection',
          text: 'Pick a day...',
          type: 'select',
          options: [
            {
              text: 'Monday',
              value: '1',
            },
            {
              text: 'Tuesday',
              value: '2',
            },
          ]
        },
      ],
    },
  ],
});

// interactive_messages_callback

{ type: 'interactive_message_callback',
  actions:
   [ { name: 'day_selection',
       type: 'select',
       selected_options: [Object] } ],
  callback_id: 'question_2',
  team: { id: 'T02L9R6LX', domain: 'hellephant' },
  channel: 'D9066R5NC',
  user: 'U4C2DDM9T',
  action_ts: '1517489936.972094',
  message_ts: '1517489928.000257',
  attachment_id: '2',
  token: 'f5LpbwCQ2D97BhNOPgn1Gotb',
  is_app_unfurl: false,
  original_message:
   { type: 'message',
     user: 'U90RBPAE6',
     text: '...',
     bot_id: 'B90UUGKSR',
     attachments: [ [Object], [Object] ],
     ts: '1517489928.000257' },
  response_url: 'https://hooks.slack.com/actions/T02L9R6LX/309104841078/xsmwspjpdhV1oSW06PQkQZp5',
  trigger_id: '308368498005.2689856711.9425688de7f023516061a4e4b2701322',
  raw_message:
   { type: 'interactive_message',
     actions: [ [Object] ],
     callback_id: 'question_2',
     team: { id: 'T02L9R6LX', domain: 'hellephant' },
     channel: { id: 'D9066R5NC', name: 'directmessage' },
     user: { id: 'U4C2DDM9T', name: 'davidnovak' },
     action_ts: '1517489936.972094',
     message_ts: '1517489928.000257',
     attachment_id: '2',
     token: 'f5LpbwCQ2D97BhNOPgn1Gotb',
     is_app_unfurl: false,
     original_message:
      { type: 'message',
        user: 'U90RBPAE6',
        text: '...',
        bot_id: 'B90UUGKSR',
        attachments: [Object],
        ts: '1517489928.000257' },
     response_url: 'https://hooks.slack.com/actions/T02L9R6LX/309104841078/xsmwspjpdhV1oSW06PQkQZp5',
     trigger_id: '308368498005.2689856711.9425688de7f023516061a4e4b2701322' },
  _pipeline: { stage: 'receive' },
  text: '2' }
Erik Kalkoken
  • 30,467
  • 8
  • 79
  • 114
dallion
  • 195
  • 5
  • 16

1 Answers1

2

No. You can not have multiple interactive menus on the same message in Slack. Its technically possible, but once the user selects one menu it will always fire for that menu, making it impossible for the user to select from multiple menus at the same time.

If you want to use multiple menus you need to spread them out over separate messages and let the user select one after the other.

Or check out the dialog function, which allows you to use multiple menus at the same time.

Erik Kalkoken
  • 30,467
  • 8
  • 79
  • 114
  • That would be fine but then I would need to store the individual "reply values" somewhere but I cant get the convo instance anywhere as I wanted to use convo.vars.. – dallion Feb 01 '18 at 13:33
  • I added a reference to the dialog feature in my answer – Erik Kalkoken Feb 01 '18 at 13:51