Manage Notification Mediums

Prev Next

1. Create a Notification Medium Instance

This POST method creates a notification medium instance. Email is the default notification medium and you can choose to use Slack or Teams for sending notifications.

Note: To execute this API, the user should have permission assigned (through policy) with action as nm.notification.create.

POST
{{url}}/api/v1/notification-service/notificationmediums

Request Example of Slack Notification Medium

curl -X POST '{{url}}/api/v1/notification-service/notificationmediums'
-H 'Authorization: Bearer <token>' -H 'content-type: application/json'
-d
'{
     "name": "corporate_slack_0612_9",
     "description": "slack description",
     "type": "slack",
     "connectionParameters": {
         "URL": "https://test.slack.com/api/",
         "token": "xoxb-xxxxxxx-xxxxxxx"
      }
}'

Response Example of Slack Notification Medium

{
    "id": "ff421f53-76fc-4fc1-805c-916e3f0e0b66",
    "name": "corporate_slack_0612_9",
    "description": "slack description",
    "type": "slack",
    "connectionParameters": {
        "URL": "https://test.slack.com/api/",
        "token": "xoxb-xxxxxxx-xxxxxxx"
    },
    "referenceCount": 0
}

Request Example of Webhook Notification Medium

curl -X POST '{{url}}/api/v1/notification-service/notificationmediums'
-H 'Authorization: Bearer <token>' -H 'content-type: application/json'
-d '{
    "name" : "WebhookNM",
    "description" : "WebhookNM",
    "type" : "webhook",
    "connectionParameters" : {
      "URL" : "https://webhook.site/07f964a4-d974-44fe-9768-d8e1501df08c"
    },
    "headers" : {
        "X-Britive-Tenant" : "tddev",
        "Authorization" : "Token 1234567890abcdefg"
    }
}

Response Example of Webhook Notification Medium

{
    "id": "0089e5c8-41ab-4466-8d9b-7d937c993a45",
    "name": "WebhookNM",
    "description": "WebhookNM",
    "type": "webhook",
    "connectionParameters": {
        "URL": "https://webhook.site/07f964a4-d974-44fe-9768-d8e1501df08c"
    },
    "headers": {
        "Authorization": "Token 1234567890abcdefg",
        "X-Britive-Tenant": "tddev"
    },
    "referenceCount": 0
}


Status: 201 Created

2. Get all Notification Mediums

This GET method returns a list of all notification mediums.

Note: To execute this API, the user should have permission assigned (through policy) with action as nm.notification.list.

GET
{{url}}/api/v1/notification-service/notificationmediums

Request Parameters

The request parameters used in this method are shown in the following table:

ParameterDescriptionData TypeRequired
filterFilter the list of notification mediums based on the name of a notification medium, The supported operators are 'eq' and 'co'. 
For example: status eq Corporate_slack
StringOptional

Request Example 

curl -X GET '{{url}}/api/v1/notification-service/notificationmediums' -H 'Authorization: Bearer <token>'

Response Example 

Status: 200 Ok
{
    "result": [
        {
            "id": "2dbb5583-fd5b-43f3-93c8-c025fe1cb7ab",
            "name": "Teams Notification",
            "description": "Updated description",
            "type": "teams",
            "connectionParameters": {
                "Webhook URL": "https://company.webhook.office.com/webhookb2/c13fde5a-baa6-47d5-b7f5-2f1ef3db5cdf@71399888-cb9e-4efd-9983-188eb47e96e4/IncomingWebhook/e8baf2c9d07c40919bd75a8f6e5fc319/bec8c7b9-5840-4f09-803a-c72c12cf676e"
            },
            "referenceCount": 11
        },
        {
            "id": "619e0455-37e1-425d-8f4b-7d8bbd8a2e29",
            "name": "corporate_slack_0612_8",
            "description": "slack description",
            "type": "slack",
            "connectionParameters": {
                "URL": "https://company.slack.com/api/",
                "token": "xoxb-2721824988759-2736764502019-N3y4qoZvWR6ElvKynZSntHFw"
            },
            "referenceCount": 0
        },
        {
            "id": "a9851bb6-1bef-40be-bd88-534c86939ca6",
            "name": "Email",
            "description": "Default Email Notification Medium",
            "type": "email",
            "connectionParameters": null,
            "referenceCount": 0
        },
    ]
}

3. Get a Notification Medium by ID

This GET method returns the details of a notification medium specified by an <notification_id >.

Note: To execute this API, the user should have permission assigned (through policy) with action as nm.notification.read.

GET
{{url}}/api/v1/notification-service/notificationmediums/<notification_id>

Request Example

curl -X GET '{{url}}/api/v1/notification-service/notificationmediums/<notification_id>' -H 'Authorization: Bearer <token>'

Response Example 

Status: 200 Ok
{
    "id": "2dbb5583-fd5b-43f3-93c8-c025fe1cb7ab",
    "name": "Teams Notification",
    "description": null,
    "type": "teams",
    "connectionParameters": {
        "Webhook URL": "https://company.webhook.office.com/webhookb2/c13fde5a-baa6-47d5-b7f5-2f1ef3db5cdf@71399888-cb9e-4efd-9983-188eb47e96e4/IncomingWebhook/e8baf2c9d07c40919bd75a8f6e5fc319/bec8c7b9-5840-4f09-803a-c72c12cf676e"
    },
    "referenceCount": 10
}

4. Update a Notification Medium Instance

This PATCH method updates the notification medium details of a specified <notification_id>.

Note: To execute this API, the user should have permission assigned (through policy) with action as nm.notification.update.

PATCH{{url}}/api/v1/notification-service/notificationmediums/<id>

Request Example 

curl -X PATCH ‘{{url}}/api/v1/notification-service/notificationmediums/<id>'
-H 'Authorization: Bearer <token>' -H 'content-type: application/json'
-d
'{
    "description": "Updated description",
    "name": "Teams Notification",
    "connectionParameters": {
        "Webhook URL": "https://company.webhook.office.com/webhookb2/c13fde5a-baa6-47d5-b7f5-2f1ef3db5cdf@71399888-cb9e-4efd-9983-188eb47e96e4/IncomingWebhook/e8baf2c9d07c40919bd75a8f6e5fc319/bec8c7b9-5840-4f09-803a-c72c12cf676e"
    },
    "referenceCount": 1
}
    }
}'

 Response Example 

Status: 204 No Content

5. Delete a Notification Medium Instance

This DELETE method deletes a specified notification medium instance specified by <notification_id>.

Note: To execute this API, the user should have permission assigned (through policy) with action as nm.notification.delete.

DELETE
{{url}}/api/v1/notification-service/notificationmediums/<notification_id >

Request Example 

curl -X DELETE '{{url}}/api/v1/notification-service/notificationmediums/<notification_id>' -H 'Authorization: Bearer <token>'

Response Example 

Status: 204 No Content

6. Get All Channels for Slack Notification Medium

This GET method returns a list of all channels for a Slack notification medium.

Note: To execute this API, the user should have permission assigned (through policy) with action as nm.channels.list.

GET
{{url}}/api/v1/notification-service/notificationmediums/{id}/channels

Request Example 

curl -X GET '{{url}}/api/v1/notification-service/notificationmediums/{id}/channels' -H 'Authorization: Bearer <token>'

Response Example 

Status: 200 Ok
{
    "result": [
        {
            "channelId": "C02MKF72621",
            "channelName": "general"
        },
        {
            "channelId": "C02MNF5167M",
            "channelName": "policy-admin"
        },
        {
            "channelId": "C02NC5AAY0Y",
            "channelName": "random"
        }
    ],
    "pagination": {
        "next": "",
        "prev": ""
    }
}

7. Validate Slack Application Channel Names 

This POST method validates Slack application channel names.

Note: To execute this API, the user should have permission assigned (through policy) with action as nm.channels.list.

GET
{{url}}/api/v1/notification-service/notificationmediums/<notificaton-midium-id>/channels/validate/names

Request Example 

curl -X GET '{{url}}/api/v1/notification-service/notificationmediums/<notificaton-midium-id>/channels/validate/names' -H 'Authorization: Bearer <token>'
[
    "random",
    "testing"
]

Response Example 

Status: 200 Ok
{
    "channels_not_found": [
        "testing"
    ],
    "random": "C06T5C8UT08"
}