0

After command '/day-off' in my Slack app this code calls message with blocks. But I need a modal window with same blocks. How to do that?

let newTimeOff = 'test';

if (ctx.state.isSlackBot) {

    newTimeOff = {
      blocks: [
        // Start date
        {
          type: 'input',
          block_id: 'start_date_datepicker',
          element: {
            type: 'datepicker',
            initial_date: '1990-04-28',
            placeholder: {
              type: 'plain_text',
              text: 'Select a date',
              emoji: true,
            },
            action_id: 'datepicker-action',
          },
          label: {
            type: 'plain_text',
            text: 'Start day',
            emoji: true,
          },
        },
        // ... and other inputs
      ],
    };

  }

  ctx.body = newTimeOff;
Roman
  • 1

1 Answers1

0


'Modal' in Slack have a different workflow than 'Messages'
You can read more about it here:
https://api.slack.com/surfaces/modals/using#creating_modals

In short, you will require https://api.slack.com/methods/views.open method to open 'Modal' windows instead of messages.

Suyash Gaur
  • 2,481
  • 2
  • 9
  • 22