Notification/Outage Banner API Guidelines

1 min read

The Notification Banner feature allows system admins to send notification to users of the chat app.

Requirements:

  • Should be prominently displayed at the top of the page.

  • Should include a clear and concise message about the outage.

  • Should have a link to a status page or more details.

  • Should be easily dismissible by the user once they have acknowledged it.

Authentication:
All endpoints require authentication and most endpoints require the CHAT_ADMIN_ALL (chat.admin.all) role.

Base URL

{base_url}/theme/graphql - same url for all operations

The base_url is the node-theme endpoint. All operations are performed with POST method.

Operations

1. Create Notification Banner

Creates a new notification banner.

Required Role: CHAT_ADMIN_ALL

Request Body:

json
{
    "query": "mutation CreateNotificationBanner($input: NotificationBannerCreateInput!) { createNotificationBanner(input: $input) { id title message link linkText startDate endDate isActive type isDismissible notificationTo } }",
    "variables": {
        "input": {
            "title": "Test Notification 1",
            "message": "This is a sample notification to all users",
            "type": "ANNOUNCEMENT",
            "isDismissible": true,
            "startDate": "2025-01-25T11:59:36.809Z",
            "endDate": "2025-01-30T11:59:36.809Z",
            "notificationTo": []
        }
    }
}

Note:

  • The startDate and endDate, signifies when you want the notification banner to be displayed to the user.

  • notificationTo signifies which company you want to be targeted with the notification. If “notificationTo” array is empty [], notification banner will be sent to all companies.
    You can target specific companies by adding their companyId as an array of string in notificationTo.
    Eg: notificationTo: [“companyA”, “companyB”, “companyC”]

  • only one notification banner can be active at the moment


ENUM for type:

none
export enum NotificationBannerType {
    MAINTENANCE = "MAINTENANCE",
    ANNOUNCEMENT = "ANNOUNCEMENT",
    INFO = "INFO",
    OUTAGE = "OUTAGE"
}

Sample Response:

json
{
    "data": {
        "createNotificationBanner": {
            "id": "tid3qp77j0f15dyv2pdtx8ev",
            "title": "Test Notification 1",
            "message": "This is a sample notification to all users",
            "link": null,
            "linkText": null,
            "startDate": "2025-01-25T11:59:36.809Z",
            "endDate": "2025-01-30T11:59:36.809Z",
            "isActive": true,
            "type": "ANNOUNCEMENT",
            "isDismissible": true,
            "notificationTo": []
        }
    }
}

2. Update Notification Banner

Updates an existing notification banner.

Required Role: CHAT_ADMIN_ALL

Request Body:

json
{
    "query": "mutation UpdateNotificationBanner($notificationBannerId: String!, $input: NotificationBannerUpdateInput!) { updateNotificationBanner(notificationBannerId: $notificationBannerId, input: $input) { id title message startDate endDate isActive } }",
    "variables": {
      "notificationBannerId": "tid3qp77j0f15dyv2pdtx8ev",
      "input": {
        "isActive": false
      }
    }
}

Sample Response:

json
{
    "data": {
        "updateNotificationBanner": {
            "id": "tid3qp77j0f15dyv2pdtx8ev",
            "title": "Test Notification 1",
            "message": "This is a sample notification to all users",
            "startDate": "2025-01-25T11:59:36.809Z",
            "endDate": "2025-01-30T11:59:36.809Z",
            "isActive": false
        }
    }
}

3. Delete Notification Banner

Deletes a notification banner.

Required Role: CHAT_ADMIN_ALL

Request Body:

json
{
    "query": "mutation DeleteNotificationBanner($notificationBannerId: String!) { deleteNotificationBanner(notificationBannerId: $notificationBannerId) { id title message startDate endDate createdAt updatedAt } }",
  "variables": {
    "notificationBannerId": "tid3qp77j0f15dyv2pdtx8ev"
  }
}

Sample Response:

json
{
    "data": {
        "deleteNotificationBanner": {
            "id": "tid3qp77j0f15dyv2pdtx8ev",
            "title": "Test Notification",
            "message": "This is a sample notification to all users",
            "startDate": "2025-01-25T11:59:36.809Z",
            "endDate": "2025-01-30T11:59:36.809Z",
            "createdAt": "2025-01-20T09:52:46.631Z",
            "updatedAt": "2025-01-20T10:04:00.450Z"
        }
    }
}

4. Get all Notification Banner

Gets all notification banner.

Required Role: CHAT_ADMIN_ALL

Request Body:

query NotificationBanners($where: NotificationBannerWhereInput, $orderBy: [NotificationBannerOrderByWithRelationInput!], $cursor: NotificationBannerWhereUniqueInput, $take: Int, $skip: Int) { notificationBanners(where: $where, orderBy: $orderBy, cursor: $cursor, take: $take, skip: $skip) { id title message startDate endDate createdAt updatedAt } }

Sample Response:

json
{
    "data": {
        "notificationBanners": [
            {
                "id": "wc1yj08yvch8d7nurj3qzaz8",
                "title": "Test Notification 1",
                "message": "This is a sample notification to all users",
                "startDate": "2025-01-25T11:59:36.809Z",
                "endDate": "2025-01-30T11:59:36.809Z",
                "createdAt": "2025-01-20T10:19:13.444Z",
                "updatedAt": "2025-01-20T10:19:13.444Z"
            }
        ]
    }
}
Last updated