Skip to content

Add OpenAPI data to /integrations/slack/events

Luke Duncalfe requested to merge 377058-openapi-slack-events into master

What does this MR do and why?

This MR adds OpenAPI data for the internal /integrations/slack/events endpoint.

Because the endpoint is only accessible to the Slack Events API, we've documented it to satisfy fuzz testing, but uses optional params so will not fail Slack requests https://gitlab.com/gitlab-org/gitlab/-/issues/377058#note_1155219928.

The endpoint is defined in EE, so we cannot mount it in the OpenAPI documentation namespace https://gitlab.com/gitlab-org/gitlab/-/issues/377058#note_1146871539.

To see the Open API data that is generated, we can move the endpoint to be mounted in the OpenAPI documentation namespace locally and run rake gitlab:openapi:generate.

Locally, this generated:

"/api/v4/integrations/slack/events":
    post:
      description: Receive Slack events
      produces:
      - application/json
      consumes:
      - application/json
      parameters:
      - in: formData
        name: token
        description: "(Deprecated by Slack) The request token, unused by GitLab"
        type: string
        required: false
      - in: formData
        name: team_id
        description: The Slack workspace ID of where the event occurred
        type: string
        required: false
      - in: formData
        name: api_app_id
        description: The Slack app ID
        type: string
        required: false
      - in: formData
        name: type
        description: The kind of event this is, usually `event_callback`
        type: string
        required: false
      - in: formData
        name: event_id
        description: A unique identifier for this specific event
        type: string
        required: false
      - in: formData
        name: event_time
        description: The epoch timestamp in seconds when this event was dispatched
        type: integer
        format: int32
        required: false
      - in: formData
        name: authed_users
        description: "(Deprecated by Slack) An array of Slack user IDs"
        type: array
        items:
          type: string
        required: false
      responses:
        '200':
          description: Successfully processed event
        '204':
          description: Failed to process event
        '401':
          description: Unauthorized
      tags:
      - integrations
      operationId: postApiV4IntegrationsSlackEvents

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #377058

Edited by Luke Duncalfe

Merge request reports