> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scrubbe.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrations: Slack, GitHub, GitLab, and More

> Connect Scrubbe to Slack, GitHub, GitLab, Google Meet, SMS, and WhatsApp — OAuth flows, webhook registration, and integration listing API reference.

Scrubbe integrations connect your existing toolchain to the incident management pipeline. Each integration follows the same general pattern: initiate an OAuth flow or supply credentials, handle the provider callback, and optionally register a webhook for real-time event delivery. All endpoints require `Authorization: Bearer <accessToken>` unless noted, and live under `/api/v1/integrations`.

***

## Slack

### POST /integrations/slack/connect

Initiate the Slack OAuth flow. Returns a redirect URL that takes the user to Slack's authorization page.

```json theme={null}
{
  "success": true,
  "message": "Slack OAuth URL generated.",
  "data": {
    "authUrl": "https://slack.com/oauth/v2/authorize?client_id=..."
  }
}
```

***

### GET /integrations/slack/oauth/callback

**OAuth callback.** Slack redirects to this URL after the user grants access. Exchanges the authorization code for a workspace token and stores the integration.

<ParamField query="code" type="string" required>
  Authorization code provided by Slack.
</ParamField>

<ParamField query="state" type="string" required>
  CSRF state token returned by Slack to verify the request origin.
</ParamField>

<Note>
  This endpoint is called automatically by Slack during the OAuth redirect. You do not need to call it directly from your application code.
</Note>

***

### POST /integrations/slack/webhook

Register or update the Slack webhook endpoint used for receiving notifications from Scrubbe in a Slack channel.

<ParamField body="webhookUrl" type="string" required>
  The Slack Incoming Webhook URL.
</ParamField>

<ParamField body="channel" type="string">
  Override the default channel from the webhook URL. Example: `"#incidents"`.
</ParamField>

***

## GitHub

### POST /integrations/github/connect

Initiate the GitHub OAuth App flow. Returns the GitHub authorization URL.

```json theme={null}
{
  "success": true,
  "message": "GitHub OAuth URL generated.",
  "data": {
    "authUrl": "https://github.com/login/oauth/authorize?client_id=..."
  }
}
```

***

### GET /integrations/github/callbacks/github

**OAuth callback.** GitHub redirects here after the user authorizes the app. Completes token exchange and stores the integration.

<ParamField query="code" type="string" required>
  Authorization code from GitHub.
</ParamField>

<ParamField query="state" type="string" required>
  State token for CSRF verification.
</ParamField>

***

### POST /integrations/github/webhook

Register a GitHub webhook so Scrubbe receives push, pull request, and deployment events.

<ParamField body="repoFullName" type="string" required>
  The repository to watch. Example: `"acme/api-service"`.
</ParamField>

<ParamField body="events" type="string[]">
  GitHub event types to subscribe to. Defaults to `["push", "pull_request", "deployment_status"]`.
</ParamField>

***

### GET /integrations/github/repos

List all GitHub repositories accessible with the connected GitHub account.

```json theme={null}
{
  "success": true,
  "message": "Repositories retrieved.",
  "data": [
    {
      "id": 123456,
      "fullName": "acme/api-service",
      "defaultBranch": "main",
      "private": true
    }
  ]
}
```

***

## GitLab

### POST /integrations/gitlab/connect

Initiate the GitLab OAuth flow.

```json theme={null}
{
  "success": true,
  "message": "GitLab OAuth URL generated.",
  "data": {
    "authUrl": "https://gitlab.com/oauth/authorize?client_id=..."
  }
}
```

***

### GET /integrations/gitlab/callback

**OAuth callback.** GitLab redirects here to complete the authorization flow.

<ParamField query="code" type="string" required>
  Authorization code from GitLab.
</ParamField>

<ParamField query="state" type="string" required>
  State token for CSRF verification.
</ParamField>

***

### POST /integrations/gitlab/webhook

Register a GitLab webhook for push, merge request, and pipeline events.

<ParamField body="projectId" type="string" required>
  The GitLab project ID or path. Example: `"42"` or `"acme/api-service"`.
</ParamField>

<ParamField body="events" type="string[]">
  GitLab event types to subscribe to. Defaults to `["push", "merge_requests", "pipeline"]`.
</ParamField>

***

### GET /integrations/gitlab/projects

List all GitLab projects accessible with the connected account.

```json theme={null}
{
  "success": true,
  "message": "Projects retrieved.",
  "data": [
    {
      "id": "42",
      "name": "api-service",
      "pathWithNamespace": "acme/api-service",
      "defaultBranch": "main"
    }
  ]
}
```

***

## Google Meet

### POST /integrations/google/meet/connect

Initiate the Google OAuth flow to enable automatic Google Meet link generation for incident war rooms.

```json theme={null}
{
  "success": true,
  "message": "Google OAuth URL generated.",
  "data": {
    "authUrl": "https://accounts.google.com/o/oauth2/v2/auth?..."
  }
}
```

***

### GET /integrations/google/meet/oauth/callback

**OAuth callback.** Google redirects here after authorization to complete the token exchange.

<ParamField query="code" type="string" required>
  Authorization code from Google.
</ParamField>

<ParamField query="state" type="string" required>
  State token for CSRF verification.
</ParamField>

***

## SMS and WhatsApp

### POST /integrations/sms/connect

Connect an SMS provider to enable text message alerts for on-call engineers.

<ParamField body="phoneNumber" type="string" required>
  E.164 formatted phone number to receive SMS alerts. Example: `"+14155552671"`.
</ParamField>

<ParamField body="provider" type="string">
  SMS provider to use. Example: `"twilio"`.
</ParamField>

***

### POST /integrations/whatsapp/connect

Connect a WhatsApp number for incident notifications.

<ParamField body="phoneNumber" type="string" required>
  E.164 formatted WhatsApp number. Example: `"+14155552671"`.
</ParamField>

<Warning>
  The WhatsApp number must be registered with the Scrubbe business account in the WhatsApp Business API before connecting.
</Warning>

***

## List integrations

### GET /integrations/:userId

List all active integrations for a given user.

<ParamField path="userId" type="string" required>
  The ID of the user whose integrations to retrieve.
</ParamField>

```json theme={null}
{
  "success": true,
  "message": "Integrations retrieved.",
  "data": [
    {
      "id": "int_01HX...",
      "type": "SLACK",
      "status": "ACTIVE",
      "connectedAt": "2025-03-10T08:00:00Z"
    },
    {
      "id": "int_02HX...",
      "type": "GITHUB",
      "status": "ACTIVE",
      "connectedAt": "2025-04-01T12:30:00Z"
    }
  ]
}
```

<ResponseField name="data[].type" type="string">
  Integration type. One of: `SLACK`, `GITHUB`, `GITLAB`, `GOOGLE_MEET`, `SMS`, `WHATSAPP`.
</ResponseField>

<ResponseField name="data[].status" type="string">
  Connection status. One of: `ACTIVE`, `DISCONNECTED`, `ERROR`.
</ResponseField>
