CentralCSP
APIAlerts

Update an alert channel

Changes a channel's name, destination, or enabled state. Leave url, secret, botToken, chatId, or memberIds out to keep what is stored. Sending memberIds replaces the whole recipient list and accepts at most 5. Enabling a channel that was switched off after delivery failures resets its failure count.

Requires the manager role on the website and the alerting plan feature.

PATCH
/v1/workspaces/{workspaceId}/websites/{websiteId}/alerts/channels/{channelId}

Authorization

headerAuthorizationBearer <JWT>

An OpenID Connect access token from signing in to CentralCSP, acting as the signed-in user.

Path Parameters

workspaceId*string

The workspace's id.

websiteId*string

The website's id.

channelId*string

The alert channel's id.

Request Body

application/json
  1. body
name?string

Display name for the channel.

Length1 <= length <= 255
url?string

An https URL on a public host. Never returned.

Length1 <= length <= 2048
secret?string

Shared secret used to sign each request, so the receiver can verify it. Never returned.

Length8 <= length <= 255
botToken?string

The bot's token from @BotFather, like 1234567890:AA…. Never returned.

Length1 <= length <= 255
chatId?string

The chat to notify: a numeric chat or group id (groups are negative), or a public channel's @username. The bot must be a member of the chat.

Length1 <= length <= 64
memberIds?array<>

The membership id of each member to notify, between 1 and 5. Each must be a workspace member with access to this website. Add another channel to reach more people.

Items1 <= items <= 5
enabled?boolean

Enabling a channel that was switched off after failures resets its failure count.

Response Body

A destination for alerts.

application/json
  1. response
id*string

The channel's id.

workspaceId*string

The workspace's id.

websiteId*string

The website's id.

name*string

Display name.

type*string

The channel type: slack, google-chat, teams, telegram, webhook or email.

configPreview*string

A masked view of the destination: the URL's origin and last few characters, the Telegram chat id, or the recipients' addresses. Full URLs and secrets are never returned.

hasSecret*boolean

Whether a secret is set: a signing secret for a webhook, a bot token for Telegram.

emailRecipients*array<>|

The members an email channel notifies. null for other types.

enabled*boolean

A disabled channel receives nothing.

disabledReason*|

Why the channel was switched off. delivery_failures means it was switched off automatically after repeated failures.

consecutiveFailures*|

Failed deliveries in a row. The channel is switched off at five, and the count resets on a success or when you enable it again.

createdAt*string

When the channel was created.

Formatdate-time
updatedAt*string

When the channel was last changed.

Formatdate-time
Example Request
curl -X PATCH 'https://api.centralcsp.com/v1/workspaces/01936b7a-6f2e-7c31-9a4d-2f8e1c5b7d90/websites/01936b7a-6f2e-7c31-9a4d-2f8e1c5b7d90/alerts/channels/01936b7a-6f2e-7c31-9a4d-2f8e1c5b7d90' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "id": "string",  "workspaceId": "string",  "websiteId": "string",  "name": "Security channel",  "type": "slack",  "configPreview": "https://hooks.slack.com/…AbCd",  "hasSecret": true,  "emailRecipients": [    {      "memberId": "string",      "userId": "string",      "hasAccess": true,      "email": "string",      "firstName": "string",      "lastName": "string",      "picture": "string"    }  ],  "enabled": true,  "disabledReason": "delivery_failures",  "consecutiveFailures": 0,  "createdAt": "2019-08-24T14:15:22Z",  "updatedAt": "2019-08-24T14:15:22Z"}