Slack Views API

The Views API from Slack — 4 operation(s) for views.

Documentation

Specifications

Schemas & Data

Other Resources

OpenAPI Specification

slack-views-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  version: '1.0'
  title: Slack Admin Access Views API
  description: "The Slack Admin API is a set of privileged endpoints\x14primarily under admin.* with related SCIM and Audit Logs APIs\x14that lets Enterprise Grid owners and admins automate organization\x11 wide management and governance. It covers user lifecycle (provision, suspend, assign roles), workspace and channel administration across workspaces (create, move, archive channels; manage membership and settings), app governance (approve/deny or allowlist/ban apps and install them to workspaces), invite request handling, and security/compliance controls such as information barriers, session and authentication policies, and org\x11level analytics exports. These APIs require elevated admin scopes and are commonly used to power automated onboarding/offboarding, centralized channel and app controls, and integrations with identity, ITSM, and compliance systems."
tags:
- name: Views
paths:
  /views.open:
    get:
      tags:
      - 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
    post:
      tags:
      - Views
      summary: Slack Open a Modal View
      description: Open a view for a user by providing a trigger_id received from a slash command, shortcut, or interactive component.
      operationId: viewsOpen
      externalDocs:
        description: API method documentation
        url: https://docs.slack.dev/reference/methods/views.open
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - trigger_id
              - view
              properties:
                trigger_id:
                  type: string
                  description: Exchange a trigger to post to the user. Must be obtained from a slash command, shortcut, or interactive component.
                view:
                  type: object
                  description: A view payload in JSON format.
      responses:
        '200':
          description: View opened
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                  view:
                    type: object
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /views.publish:
    get:
      tags:
      - 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: null
                  external_id: ''
                  hash: '156772938.1827394'
                  id: VMHU10V25
                  notify_on_close: false
                  previous_view_id: null
                  private_metadata: Shh it is a secret
                  root_view_id: VMHU10V25
                  state:
                    values: {}
                  submit: null
                  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
    post:
      tags:
      - Views
      summary: Slack Publish a View to the App Home Tab
      description: Publish a static view for a user to the App Home tab.
      operationId: viewsPublish
      externalDocs:
        description: API method documentation
        url: https://docs.slack.dev/reference/methods/views.publish
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - user_id
              - view
              properties:
                user_id:
                  type: string
                  description: ID of the user you want to publish a view to.
                view:
                  type: object
                  description: A view payload in JSON format.
                hash:
                  type: string
      responses:
        '200':
          description: View published
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                  view:
                    type: object
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /views.push:
    get:
      tags:
      - 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: null
                  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:
      - 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: null
                  private_metadata: ''
                  root_view_id: VNN729E3U
                  state:
                    values: {}
                  submit: null
                  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
    post:
      tags:
      - Views
      summary: Slack Update an Existing View
      description: Update an existing view.
      operationId: viewsUpdate
      externalDocs:
        description: API method documentation
        url: https://docs.slack.dev/reference/methods/views.update
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                view_id:
                  type: string
                  description: A unique identifier of the view to be updated.
                external_id:
                  type: string
                view:
                  type: object
                  description: A view payload in JSON format.
                hash:
                  type: string
                  description: A string that represents view state to protect against possible race conditions.
      responses:
        '200':
          description: View updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  ok:
                    type: boolean
                  view:
                    type: object
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK