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

# Administration API: Notifications

> Read the account's Slack connection, set the Slack and email destinations of a workspace's Bolt system alerts, and disconnect Slack with the Administration API.

Check whether Slack is connected to your Paradime account, set where a workspace's Bolt system alerts go, and disconnect Slack, from code.

> [!NOTE]
>
> **Prerequisites:**
>
> * These operations are part of the Enterprise plan. On other plans, they fail with `PLAN_UPGRADE_REQUIRED`.
> * An account API key or a workspace API key. With an account key, send `X-Paradime-Workspace` to read or set a workspace's alerts. `disconnectSlack` needs an account key.
> * The **Notifications admin** capability group.
>
> Keys, errors, and steps that need a person work the same in every area. See [Conventions](https://docs.paradime.io/developers/graphql-api/admin-api/conventions.md).

## Operations

| Operation | Type | What it does | Capability group |
| - | - | - | - |
| [`slack`](https://docs.paradime.io/graphql-reference/queries/slack) | Query | Reads the account's Slack connection, which every workspace shares. | Notifications admin |
| [`Workspace.alertNotifications`](https://docs.paradime.io/graphql-reference/types/Workspace) | Field | Reads where one category of a workspace's alerts goes. | Notifications admin |
| [`setAlertNotifications`](https://docs.paradime.io/graphql-reference/mutations/setAlertNotifications) | Mutation | Sets the Slack channels, Slack users, and admin emails one category of alerts goes to. | Notifications admin |
| [`disconnectSlack`](https://docs.paradime.io/graphql-reference/mutations/disconnectSlack) | Mutation | Disconnects Slack from the account, for every workspace. Account keys only. | Notifications admin |

## Check the Slack connection

Slack connects once for the whole account, so `slack` needs no `X-Paradime-Workspace` header.

* `status` is `CONNECTED` when Slack is connected. It is `PENDING_USER_ACTION` when an account admin has to connect Slack in a browser: send them to `installUrl`, the Paradime settings page where Slack is connected. An API call can't finish this step. See [Steps that need a person](https://docs.paradime.io/developers/graphql-api/admin-api/conventions.md#pending-user-action).
* `isReconnectRequired` is `true` when Slack must be connected again to grant the scopes in `missingScopes`. `installUrl` is set until it is done.

```graphql theme={"system"}
query SlackConnection {
  slack {
    status
    installUrl
    teamId
    teamName
    isReconnectRequired
    missingScopes
  }
}
```

> [accordion] Example response
>
> ```json theme={"system"}
> {
>   "data": {
>     "slack": {
>       "status": "CONNECTED",
>       "installUrl": null,
>       "teamId": "T01ABCDEF23",
>       "teamName": "Acme Data",
>       "isReconnectRequired": false,
>       "missingScopes": []
>     }
>   }
> }
> ```

## Route Bolt system alerts

[Bolt system alerts](https://docs.paradime.io/products/bolt/creating-schedules/notification-settings.md#bolt-system-alerts) tell you about problems with Bolt itself, such as a repository Bolt can't clone. In Paradime, you set them in the **Bolt System Alerts** panel of the Bolt schedules homepage. Through the API, `setAlertNotifications` sets them for the targeted workspace. The only category is `BOLT_SYSTEM`.

* A destination you leave out keeps its value. A destination you send replaces its value.
* `slack.channelIds` and `slack.userIds` are the full set of Slack destinations. Use Slack ids, such as `C04ABCDEF12` for a channel and `U02ABCDEF34` for a user, not names. To remove every Slack destination, send both lists empty.
* Slack must be connected to the account before you add a Slack destination.
* `email.isEnabled` turns alert emails to the workspace admins on or off, as the **Email workspace admins** switch does.

```graphql theme={"system"}
mutation RouteSystemAlerts($input: SetAlertNotificationsInput!) {
  setAlertNotifications(input: $input) {
    alertNotifications {
      category
      slack {
        channelIds
        userIds
      }
      email {
        isEnabled
      }
    }
  }
}
```

```json theme={"system"}
{
  "input": {
    "category": "BOLT_SYSTEM",
    "slack": {
      "channelIds": ["C04ABCDEF12"],
      "userIds": []
    },
    "email": {
      "isEnabled": true
    }
  }
}
```

> [accordion] Example response
>
> ```json theme={"system"}
> {
>   "data": {
>     "setAlertNotifications": {
>       "alertNotifications": {
>         "category": "BOLT_SYSTEM",
>         "slack": {
>           "channelIds": ["C04ABCDEF12"],
>           "userIds": []
>         },
>         "email": {
>           "isEnabled": true
>         }
>       }
>     }
>   }
> }
> ```

Bolt system alerts go to Slack or Microsoft Teams, not both. If the workspace sends them to Teams, remove the Teams destinations in Paradime before you add Slack destinations. The API doesn't read or change the panel's other settings: Teams destinations, the email addresses you add one by one, and the **Frequency**. They keep their values.

To read the destinations, select `alertNotifications` on the workspace:

```graphql theme={"system"}
query SystemAlertDestinations {
  workspace {
    alertNotifications(category: BOLT_SYSTEM) {
      slack {
        channelIds
        userIds
      }
      email {
        isEnabled
      }
    }
  }
}
```

## Disconnect Slack

`disconnectSlack` removes the Slack connection from the whole account, for every workspace. It needs an account key, and no `X-Paradime-Workspace` header. Send the `teamId` you expect to be connected: if another Slack team is connected, nothing changes and the call fails with `CONFLICT`. Disconnecting again is not an error.

```graphql theme={"system"}
mutation DisconnectSlack($input: DisconnectSlackInput!) {
  disconnectSlack(input: $input) {
    slack {
      status
      installUrl
    }
  }
}
```

```json theme={"system"}
{
  "input": {
    "teamId": "T01ABCDEF23"
  }
}
```

After the call, `status` is `PENDING_USER_ACTION`, and `installUrl` is where an account admin connects Slack again.

## Errors

These are the cases specific to notifications. For the error format and the codes every area shares, see [Errors](https://docs.paradime.io/developers/graphql-api/admin-api/conventions.md#errors).

| Code | When |
| - | - |
| `VALIDATION_FAILED` | You add a Slack destination while Slack is not connected, a Slack id is blank, or the workspace sends Bolt system alerts to Microsoft Teams. |
| `CONFLICT` | `disconnectSlack` names a `teamId` other than the connected Slack team. |
| `MISSING_CAPABILITY` | A workspace API key calls `disconnectSlack`. |

## Related

* [Python SDK: Notifications](https://docs.paradime.io/developers/python-sdk/modules/admin/notifications.md): the same operations in `paradime.admin.notifications`.
* [Notifications](https://docs.paradime.io/products/settings/configuration/notifications.md): every kind of notification Paradime sends, and where to set it.
* [Notification settings](https://docs.paradime.io/products/bolt/creating-schedules/notification-settings.md): schedule notifications and Bolt system alerts in Paradime.
* [Slack](https://docs.paradime.io/integrations/slack.md) and [Microsoft Teams](https://docs.paradime.io/integrations/microsoft-teams.md): connect the chat tools.


## Related topics

- [Administration API](https://docs.paradime.io/developers/graphql-api/admin-api/index.md)
- [Administration API: Conventions](https://docs.paradime.io/developers/graphql-api/admin-api/conventions.md)
- [Administration API: Setup status](https://docs.paradime.io/developers/graphql-api/admin-api/setup-status.md)
- [Administration API: Bolt](https://docs.paradime.io/developers/graphql-api/admin-api/bolt.md)
- [Administration API: API keys](https://docs.paradime.io/developers/graphql-api/admin-api/api-keys.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.