Notification channels
Get list of notification channels
URL: GET /api/notificationChannels
Request url parameters: None
Request body parameters: None
Response body parameters
notificationChannels: List of notificationChannels
Example
GET /api/notificationChannels/
{
"notificationChannels": [
{
"id": 20,
"version": 1,
"createdOn": 1466023669000,
"modifiedOn": 1466023669000,
"type": "EMAIL",
"enabled": true,
"options": {
"emailRecipients": [
"[email protected]"
],
"notifyOnOk": false
}
}
]
}
Get one notification channel
URL: GET /api/notificationChannels/:id
Request url parameters: id
Request body parameters: None
Response body parameters:
id: NotificationChannel IDtype: Type of notification channels; Valid values are:EMAILfor email notificationsSNSfor aws sns notificationsPAGER_DUTYfor pager duty notificationsSLACKfor slack notificationsVICTOROPSfor victorOps notificationsWEBHOOKfor generic notification channel
name: Optional name of the notification channel; Note that notification channel names must be unique and no more than 255 charactersenabled:trueif the notification channel is being processed and events can fire;falseotherwiseoptions: this contains different properties related to the different notification channel type:* `EMAIL` ** `emailRecipients` is a list of email addresses * `SNS` ** `snsTopicARNs` is a list of AWS SNS arn topics * `SLACK` ** `channel` slack channel name ** `notifyOnOk` boolean flag to receive a notification message when the notification state changed from ACTIVE to OK ** `url` slack incoming webhook url endpoint (https://api.slack.com/incoming-webhooks) * `PAGER_DUTY` ** `channel` pagerDuty channel name ** `resolveOnOk` boolean flag to send a notification to resolve the incident in PD when the notification state changed from ACTIVE to OK * `VICTOROPS` ** `apiKey` mandatory api key retrieved from VictorOps integration settings page ** `routingKey` mandatory routing key retrieved from VictorOps integration settings page ** `resolveOnOk` boolean flag to send a notification to resolve the incident in VictorOps when the notification state changed from ACTIVE to OK * `WEBHOOK` ** `url` generic url endpoint ** `notifyOnOk` boolean flag to send a notification to resolve the incident in VictorOps when the notification state changed from ACTIVE to OK
Note: The notification channels can be enabled by the alert
version: Revision version of the notification channel configurationcreatedOn: Unix-timestamp of time when the notification channel was createdmodifiedOn: Unix-timestamp of time when the notification channel was last modified
Errors
404 Not Foundif the notification channel ID is not found
Example by Type
Type: EMAIL
{
"notificationChannel": {
"id": 20,
"version": 1,
"createdOn": 1466023669000,
"modifiedOn": 1466023669000,
"type": "EMAIL",
"enabled": true,
"name": "emailChannel",
"options": {
"emailRecipients": [
"[email protected]"
],
"notifyOnOk": false
}
}
}
Type: SNS
{
"notificationChannel": {
"id": 23,
"version": 1,
"createdOn": 1466023755000,
"modifiedOn": 1466023755000,
"type": "SNS",
"enabled": true,
"name": "snsChannel",
"options": {
"snsTopicARNs": [
"arn:aws:sns:us-east-1:273107874544:sergiotest2"
],
"notifyOnOk": false
}
}
}
Type: SLACK
{
"notificationChannel": {
"id": 31,
"version": 2,
"createdOn": 1466095456000,
"modifiedOn": 1466095473000,
"type": "SLACK",
"enabled": true,
"name": "slackChannel",
"options": {
"notifyOnOk": false,
"channel": "slackin"
"url" : "https://hooks.slack.com/services/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/"
}
}
}
Type: PAGER_DUTY
{
"notificationChannel": {
"id": 35,
"version": 1,
"createdOn": 1466449404000,
"modifiedOn": 1466449404000,
"type": "PAGER_DUTY",
"enabled": true,
"name": "pdChannel",
"options": {
"account": "draios-test",
"serviceKey": "6ce6c022c87a8843aa2f97c86be06c81",
"serviceName": "Sergio-test",
"resolveOnOk": true
}
}
}
Type: VICTOROPS
{
"notificationChannel": {
"id": 36,
"version": 1,
"createdOn": 1466456928000,
"modifiedOn": 1466456928000,
"type": "VICTOROPS",
"enabled": true,
"name": "victorOpsChannel",
"options": {
"resolveOnOk": true,
"apiKey": "01ce050e-90c1-4ba6-aa59-f5ae5849557e",
"routingKey": "myfaketeam"
}
}
}
Create notification channel
URL: POST /api/notificationChannels/
Request url parameters: None
Request body parameters: All the response body parameters specified in Get notification channel except:
idversioncreatedOnmodifiedOn
Response parameters: See Get Notification Channels
Errors
404 Not Foundnotification channel ID not found422 Name length must be between 1 and 255 characterswrong length name422 The parameter notificationChannel.type is set to an invalid value. Valid values are: EMAIL|PAGER_DUTY|SLACK|SNS|VICTOROPSnot allowed notificationChannel.type422 The url endpoint is not valid. It should start with: 'https://hooks.slack.com/services/not allowed url endpoint422 The apiKey is missing inside optionsapiKey is mandatory for victorOps channel422 The routingKey is missing inside optionsroutingKey is mandatory for victorOps channel
Modify notification channel
URL: PUT /api/notificationChannels/:id
Request url parameters: id
Request body parameters: All the response body parameters specified in Get notification channel except:
createdOnmodifiedOn
Response parameters: See the Get notification Channels
Note It is not possible to modify the slack channel name
Note The version number must be obtained via a GET request.
Errors
404 Not Foundnotification channel ID not found409 Conflict versionwrong version number422 Name length must be between 1 and 255 characterswrong length name422 The parameter notificationChannel.type is set to an invalid value. Valid values are: EMAIL|PAGER_DUTY|SLACK|SNS|VICTOROPSnot allowed notificationChannel.type422 The url endpoint is not valid. It should start with: 'https://hooks.slack.com/services/not allowed url endpoint422 The apiKey is missing inside optionsapiKey is mandatory for victorOps channel422 The routingKey is missing inside optionsroutingKey is mandatory for victorOps channel422 Missing notification channel idmissing notification channel id
Delete notification channel
URL: DELETE /api/notificationChannels/:id
Request url parameters: id
Request body parameters: None
Response parameters: None
204 No content
Errors:
404 Not Foundnotification channel ID not found