Slack Views API

The Slack Views API lets your app build and control Block Kit interfaces inside Slackprimarily modals and the App Home tab. With methods like views.open, views.update, and views.push, your app can launch multi-step modal flows in response to interactive triggers (slash commands, shortcuts, or message actions), update them in place, or push new steps onto the stack. Using views.publish, you can render a personalized, dynamic Home tab for each user.

OpenAPI Specification

slack-views-openapi.yml Raw ↑
openapi: 3.1.0
info:
  version: "1.0"
  title: Slack Views API
  description: "The Slack Views API lets your app build and control Block Kit interfaces inside Slack\x14primarily modals and the App Home tab. With methods like views.open, views.update, and views.push,
    your app can launch multi-step modal flows in response to interactive triggers (slash commands, shortcuts, or message actions), update them in place, or push new steps onto the stack. Using views.publish,
    you can render a personalized, dynamic Home tab for each user. Submissions and closes generate interactivity payloads (view_submission and view_closed) that let you validate inputs, return per-field
    errors, and persist state; you can also pass callback_id and private_metadata to track context. Concurrency is handled via a view hash to avoid overwriting stale content. In short, the Views API provides
    the lifecycle and plumbing for rich, interactive app experiences directly in Slack."
paths:
  /views.open:
    get:
      tags:
      - Get
      - Open
      - Views
      description: Open a view for a user.
      externalDocs:
        description: API method documentation
        url: https://api.slack.com/methods/views.open
      operationId: getViewsOpen
      parameters:
      - name: token
        in: header
        description: 'Authentication token. Requires scope: `none`'
        required: true
        schema:
          type: string
      - name: trigger_id
        in: query
        description: Exchange a trigger to post to the user.
        required: true
        schema:
          type: string
      - name: view
        in: query
        description: >-
          A [view payload](/reference/surfaces/views). This must be a
          JSON-encoded string.
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Typical success response includes the opened view payload.
          content:
            application/json:
              schema:
                title: Default success template
                required:
                - ok
                type: object
                properties:
                  ok:
                    $ref: '#/components/schemas/defs_ok_true'
                additionalProperties: true
                description: >-
                  This method either only returns a brief _OK_ response or a
                  verbose schema is not available for this method.
              example:
                ok: true
                view:
                  app_id: AA4928AQ
                  blocks:
                  - block_id: a_block_id
                    element:
                      action_id: an_action_id
                      type: plain_text_input
                    label:
                      emoji: true
                      text: A simple label
                      type: plain_text
                    optional: false
                    type: input
                  bot_id: BA13894H
                  callback_id: identify_your_modals
                  clear_on_close: false
                  external_id: ''
                  hash: '156772938.1827394'
                  id: VMHU10V25
                  notify_on_close: false
                  private_metadata: Shh it is a secret
                  root_view_id: VMHU10V25
                  state:
                    values: {}
                  submit:
                    text: Create
                    type: plain_text
                  team_id: T8N4K1JN
                  title:
                    text: Quite a plain modal
                    type: plain_text
                  type: modal
        default:
          description: >-
            Typical error response, before getting to any possible validation
            errors.
          content:
            application/json:
              schema:
                title: Default error template
                required:
                - ok
                type: object
                properties:
                  ok:
                    $ref: '#/components/schemas/defs_ok_false'
                additionalProperties: true
                description: >-
                  This method either only returns a brief _not OK_ response or a
                  verbose schema is not available for this method.
              example:
                error: invalid_arguments
                ok: false
                response_metadata:
                  messages:
                  - invalid `trigger_id`
      security:
      - slackAuth:
        - none
      summary: Slack Get Views Open
      x-api-evangelist-processing:
        GenerateOperationSummariesFromPath: true
        PascalCaseOperationSummaries: true
        CaselCaseOperationIds: true
        ChooseTags: true
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /views.publish:
    get:
      tags:
      - Get
      - Publish
      - Views
      description: Publish a static view for a User.
      externalDocs:
        description: API method documentation
        url: https://api.slack.com/methods/views.publish
      operationId: getViewsPublish
      parameters:
      - name: token
        in: header
        description: 'Authentication token. Requires scope: `none`'
        required: true
        schema:
          type: string
      - name: user_id
        in: query
        description: '`id` of the user you want publish a view to.'
        required: true
        schema:
          type: string
      - name: view
        in: query
        description: >-
          A [view payload](/reference/surfaces/views). This must be a
          JSON-encoded string.
        required: true
        schema:
          type: string
      - name: hash
        in: query
        description: >-
          A string that represents view state to protect against possible race
          conditions.
        schema:
          type: string
      responses:
        '200':
          description: Typical success response includes the published view payload.
          content:
            application/json:
              schema:
                title: Default success template
                required:
                - ok
                type: object
                properties:
                  ok:
                    $ref: '#/components/schemas/defs_ok_true'
                additionalProperties: true
                description: >-
                  This method either only returns a brief _OK_ response or a
                  verbose schema is not available for this method.
              example:
                ok: true
                view:
                  app_id: AA4928AQ
                  blocks:
                  - block_id: 2WGp9
                    text:
                      text: A simple section with some sample sentence.
                      type: mrkdwn
                      verbatim: false
                    type: section
                  bot_id: BA13894H
                  callback_id: identify_your_home_tab
                  clear_on_close: false
                  close:
                  external_id: ''
                  hash: '156772938.1827394'
                  id: VMHU10V25
                  notify_on_close: false
                  previous_view_id:
                  private_metadata: Shh it is a secret
                  root_view_id: VMHU10V25
                  state:
                    values: {}
                  submit:
                  team_id: T8N4K1JN
                  type: home
        default:
          description: >-
            Typical error response, before getting to any possible validation
            errors.
          content:
            application/json:
              schema:
                title: Default error template
                required:
                - ok
                type: object
                properties:
                  ok:
                    $ref: '#/components/schemas/defs_ok_false'
                additionalProperties: true
                description: >-
                  This method either only returns a brief _not OK_ response or a
                  verbose schema is not available for this method.
              example:
                error: invalid_arguments
                ok: false
                response_metadata:
                  messages:
                  - invalid `user_id`
      security:
      - slackAuth:
        - none
      summary: Slack Get Views Publish
      x-api-evangelist-processing:
        GenerateOperationSummariesFromPath: true
        PascalCaseOperationSummaries: true
        CaselCaseOperationIds: true
        ChooseTags: true
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /views.push:
    get:
      tags:
      - Get
      - Push
      - Views
      description: Push a view onto the stack of a root view.
      externalDocs:
        description: API method documentation
        url: https://api.slack.com/methods/views.push
      operationId: getViewsPush
      parameters:
      - name: token
        in: header
        description: 'Authentication token. Requires scope: `none`'
        required: true
        schema:
          type: string
      - name: trigger_id
        in: query
        description: Exchange a trigger to post to the user.
        required: true
        schema:
          type: string
      - name: view
        in: query
        description: >-
          A [view payload](/reference/surfaces/views). This must be a
          JSON-encoded string.
        required: true
        schema:
          type: string
      responses:
        '200':
          description: Typical success response includes the pushed view payload.
          content:
            application/json:
              schema:
                title: Default success template
                required:
                - ok
                type: object
                properties:
                  ok:
                    $ref: '#/components/schemas/defs_ok_true'
                additionalProperties: true
                description: >-
                  This method either only returns a brief _OK_ response or a
                  verbose schema is not available for this method.
              example:
                ok: true
                view:
                  app_id: AAD3351BQ
                  blocks:
                  - block_id: edit_details
                    element:
                      action_id: detail_input
                      type: plain_text_input
                    label:
                      text: Edit details
                      type: plain_text
                    type: input
                  bot_id: BADF7A34H
                  callback_id: view_4
                  clear_on_close: true
                  close:
                    emoji: true
                    text: Back
                    type: plain_text
                  external_id: ''
                  hash: 1569362015.55b5e41b
                  id: VNM522E2U
                  notify_on_close: false
                  previous_view_id:
                  private_metadata: ''
                  root_view_id: VNN729E3U
                  state:
                    values: {}
                  submit:
                    emoji: true
                    text: Save
                    type: plain_text
                  team_id: T9M4RL1JM
                  title:
                    emoji: true
                    text: Pushed Modal
                    type: plain_text
                  type: modal
        default:
          description: Typical error response.
          content:
            application/json:
              schema:
                title: Default error template
                required:
                - ok
                type: object
                properties:
                  ok:
                    $ref: '#/components/schemas/defs_ok_false'
                additionalProperties: true
                description: >-
                  This method either only returns a brief _not OK_ response or a
                  verbose schema is not available for this method.
              example:
                error: invalid_arguments
                ok: false
                response_metadata:
                  messages:
                  - 'missing required field: title'
      security:
      - slackAuth:
        - none
      summary: Slack Get Views Push
      x-api-evangelist-processing:
        GenerateOperationSummariesFromPath: true
        PascalCaseOperationSummaries: true
        CaselCaseOperationIds: true
        ChooseTags: true
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /views.update:
    get:
      tags:
      - Get
      - Update
      - Views
      description: Update an existing view.
      externalDocs:
        description: API method documentation
        url: https://api.slack.com/methods/views.update
      operationId: getViewsUpdate
      parameters:
      - name: token
        in: header
        description: 'Authentication token. Requires scope: `none`'
        required: true
        schema:
          type: string
      - name: view_id
        in: query
        description: >-
          A unique identifier of the view to be updated. Either `view_id` or
          `external_id` is required.
        schema:
          type: string
      - name: external_id
        in: query
        description: >-
          A unique identifier of the view set by the developer. Must be unique
          for all views on a team. Max length of 255 characters. Either
          `view_id` or `external_id` is required.
        schema:
          type: string
      - name: view
        in: query
        description: >-
          A [view object](/reference/surfaces/views). This must be a
          JSON-encoded string.
        schema:
          type: string
      - name: hash
        in: query
        description: >-
          A string that represents view state to protect against possible race
          conditions.
        schema:
          type: string
      responses:
        '200':
          description: Typical success response includes the updated view payload.
          content:
            application/json:
              schema:
                title: Default success template
                required:
                - ok
                type: object
                properties:
                  ok:
                    $ref: '#/components/schemas/defs_ok_true'
                additionalProperties: true
                description: >-
                  This method either only returns a brief _OK_ response or a
                  verbose schema is not available for this method.
              example:
                ok: true
                view:
                  app_id: AAD3351BQ
                  blocks:
                  - accessory:
                      action_id: button_4
                      text:
                        text: Click me
                        type: plain_text
                      type: button
                    block_id: s_block
                    text:
                      emoji: true
                      text: I am but an updated modal
                      type: plain_text
                    type: section
                  bot_id: BADF7A34H
                  callback_id: view_2
                  clear_on_close: true
                  close:
                    emoji: true
                    text: Close
                    type: plain_text
                  external_id: ''
                  hash: 1569262015.55b5e41b
                  id: VNM522E2U
                  notify_on_close: false
                  previous_view_id:
                  private_metadata: ''
                  root_view_id: VNN729E3U
                  state:
                    values: {}
                  submit:
                  team_id: T9M4RL1JM
                  title:
                    emoji: true
                    text: Updated Modal
                    type: plain_text
                  type: modal
        default:
          description: Typical error response.
          content:
            application/json:
              schema:
                title: Default error template
                required:
                - ok
                type: object
                properties:
                  ok:
                    $ref: '#/components/schemas/defs_ok_false'
                additionalProperties: true
                description: >-
                  This method either only returns a brief _not OK_ response or a
                  verbose schema is not available for this method.
              example:
                error: not_found
                ok: false
      security:
      - slackAuth:
        - none
      summary: Slack Get Views Update
      x-api-evangelist-processing:
        GenerateOperationSummariesFromPath: true
        PascalCaseOperationSummaries: true
        CaselCaseOperationIds: true
        ChooseTags: true
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  schemas: {}
tags:
- name: Get
- name: Open
- name: Publish
- name: Push
- name: Update
- name: Views