Skip to content

How to handle multiple views? #21

Open
@hcyildirim

Description

@hcyildirim

Hi, seems like views_open is not catching up callback_ids, can you help me with that?

# start_new_modal.rb

def self.payload(trigger_id)
    {
      trigger_id: trigger_id,
      view: {
        type: "modal",
        callback_id: "unique-id",
        title: {
          type: "plain_text",
          text: "Start",
          emoji: true
        },
        submit: {
          type: "plain_text",
          text: "Submit",
          emoji: true
        },
        close: {
          type: "plain_text",
          text: "Cancel",
          emoji: true
        },
        blocks: [
          {
            block_id: "conversation",
            type: "input",
            label: {
              type: "plain_text",
              text: "Channel"
            },
            element: {
              action_id: "ml_conversation_input",
              type: "conversations_select",
              response_url_enabled: true,
              placeholder: {
                type: "plain_text",
                text: "Start typing #channel"
              }
            }
          },
        ]
      }
    }
  end
#  actions/task.rb

SlackRubyBotServer::Events.configure do |config|
  config.on :action, "block_actions" do |action|
      payload = StartNewModal.payload(trigger_id)
      slack_client.views_open(payload)
  end
end
# actions/start_new_modal.rb

SlackRubyBotServer::Events.configure do |config|
  config.on :action, 'view_submission', 'unique-id' do |action|
   # nothing comes here
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions