Go to Slack

Reference: View payloads

View payloads are used when calling methods like views.open, views.update, and views.push.

Our guide to Block Kit in modals shows you how to use the view payload.


Fields

Field Type Required? Description
type String Yes The type of view. Must be set to modal.
title Object Yes The title that appears in the top-left of the modal. Must be a plain_text text element with a max length of 24 characters.
blocks Array Yes An array of blocks that defines the content of the view. Max of 100 blocks.
close Object No An optional plain_text element that defines the text displayed in the close button at the bottom-right of the view. Max length of 24 characters.
submit Object No An optional plain_text element that defines the text displayed in the submit button at the bottom-right of the view. submit is required when an input block is within the blocks array. Max length of 24 characters.
private_metadata String No An optional string that will be sent to your app in view_submission and block_actions events. Max length of 3000 characters.
callback_id String No An identifier to recognize interactions and submissions of this particular modal. Don't use this to store sensitive information (use private_metadata instead). Max length of 255 characters.
clear_on_close Boolean No When set to true, clicking on the close button will clear all views in a modal and close it. Defaults to false.
notify_on_close Boolean No Indicates whether Slack will send your request URL a view_closed event when a user clicks the close button. Defaults to false.
external_id String No A custom identifier that must be unique for all views on a per-team basis.

Example

{
  "type": "modal",
  "title": {
    "type": "plain_text",
    "text": "Modal title"
  },
  "blocks": [
    {
      "type": "section",
      "text": {
        "type": "mrkdwn",
        "text": "It's Block Kit...but _in a modal_"
      },
      "block_id": "section1",
      "accessory": {
        "type": "button",
        "text": {
          "type": "plain_text",
          "text": "Click me"
        },
        "action_id": "button_abc",
        "value": "Button value",
        "style": "danger"
      }
    },
    {
      "type": "input",
      "label": {
        "type": "plain_text",
        "text": "Input label"
      },
      "element": {
        "type": "plain_text_input",
        "action_id": "input1",
        "placeholder": {
          "type": "plain_text",
          "text": "Type in here"
        },
        "multiline": false
      }, 
      "optional": false
    }
  ],
  "close": {
    "type": "plain_text",
    "text": "Cancel"
  },
  "submit": {
    "type": "plain_text",
    "text": "Save"
  },
  "private_metadata": "Shhhhhhhh",
  "callback_id": "view_identifier_12"
}