Notification groups

Notification groups provide a way to send notifications to groups of users and/or email addresses about events on CareHQ (for example when an action is completed.

The notification group object

Attributes

  • _id
    string

    A unique Id for the notification group.

  • created
    string

    The date/time the nominal code was created.

  • description
    string

    A description of the notification groups purpose.

  • email_to
    list of strings

    A list of email addresses to notify.

  • modified
    string

    The date/time the nominal code was modified.

  • name
    string

    A unique name for the notification group.

  • users
    list of strings

    A list of users to notify.

The notification group object
{
    "_id": "6724fbc74f73a2cebf637812",
    "created": "2024-11-01 16:03:19",
    "description": "Billing and credit control department",
    "email_to": [
        "finance@marshallcare.co.uk"
    ],
    "modified": "2024-11-01 16:03:19",
    "name": "Finance",
    "users": [
        "6724fbc74f73a2cebf6377fe"
    ]
}

List all notification groups

Return a list of notification groups setup for your account on CareHQ.

Parameters

  • attributes
    optional
    default ['_id']

    A list of attributes to include for fetched objects.

  • filters-ids
    optional

    A filter that accepts a list of Ids and filters the items returned to those with an Id in the list.

  • filters-modified_after
    optional

    A filter that accepts a date/time and filters the items returned to those modified after the date/time.

  • filters-modified_before
    optional

    A filter that accepts a date/time and filters the items returned to those modified before the date/time.

  • filters-q
    optional

    A case insensitive keyword filter applied to the following fields; description, name.

  • page
    optional
    default 1

    The page number to fetch.

  • per_page
    optional
    default 10

    The number of items to return per page.

  • sort_by
    optional
    default _id

    A list of fields the returned items can be sorted by. Fields prefixed with minus (-) sign are sorted in descending order.

    • _id
    • created
    • modified
    • name

Response

Returns a page of notification groups.

GET
/v1/notification-groups
var notificationGroups = apiClient.Request(
    HttpMethod.Get,
    "notification-groups",
    new MultiValueDict()
        .Add("attributes", "name")
);
<?php

$notification_groups = $api_client->request(
    'GET',
    'notification-groups',
    [
        'attributes'=>['name']
    ]
);
notification_groups = api_client(
    'GET',
    'notification-groups',
    params={
        'attributes': ['name']
    }
)
notification_groups = api_client.request(
    'GET',
    'notification-groups',
    params: {
        'attributes' => ['name']
    }
)
Response
{
    "item_count": 1,
    "items": [
        {
            "_id": "6724fbc74f73a2cebf637812",
            "name": "Finance"
        }
    ],
    "page": 1,
    "page_count": 1,
    "per_page": 10
}

Retrieve a notification group

Retrieve a notification group object.

Response

Returns a notification group object.

GET
/v1/notification-groups/<notification_group_id>
var notificationGroup = apiClient.Request(
    HttpMethod.Get,
    $"notification-groups/{notificationGroupId}"
);
<?php

$notification_group = $api_client->request(
    'GET',
    'notification-groups/' . $notification_group_id
);
notification_group = api_client(
    'GET',
    f'notification-groups/{notification_group_id}'
)
notification_group = api_client.request(
    'GET',
    "notification-groups/#{notification_group_id}"
)
Response
{
    "_id": "6724fbc74f73a2cebf637812",
    "created": "2024-11-01 16:03:19",
    "description": "Billing and credit control department",
    "email_to": [
        "finance@marshallcare.co.uk"
    ],
    "modified": "2024-11-01 16:03:19",
    "name": "Finance",
    "users": [
        "6724fbc74f73a2cebf6377fe"
    ]
}