Skip to main content

Notifications

A notification is a message presented to a specific user in Kojo.

Schema​

Notification​

NameTypeDescriptionExample
idIDThe unique notification ID"ckmnpybisiy5x08abky4g2d1f"
createdAtDateTimeWhen this notification was created"2021-03-24 17:26:46.983Z"
payloadNotificationPayloadAdditional parameters to this notification{lastSyncTime:"2021-02-02T00:00:00"}
typeNotificationTypeThe type of notificationintegration_issue
updatedAtDateTimeWhen this notification was last modified"2021-03-24 17:26:46.983Z"

Enums​

NotificationType​

ValueDescription
integration_issueThere is an issue with an integration that requires some attention.
integration_issue_resolvedAn integration issue has been resolved.

Notification Payload​

Each notification should include a payload, which is a JSON field that includes some additional information.

For notifications of type integration_issue, the payload should include the following fields:

ValueDescriptionExample
lastSyncTimeThe last time that contact was made with the integrated system."2021-03-14T15:92:65"
orderOptional: if there's a problem with one particular order, include the order ID here. If this parameter isn't included, the notification will advise the user that there is a general issue with the integration.{"id": "cjld2cjxh0000qzrmn831i7rn"}

For notifications of type integration_issue_resolved, the payload should include the following fields:

ValueDescriptionExample
resolvedAtThe time the issue was resolved."2021-03-14T15:92:65"

REST Endpoints​

GET /notifications​

Read all Notifications, with pagination.

Parameters​

Accepts all standard pagination parameters.

Allowed orderBy fields: id, type, isRead, readAt, createdAt, updatedAt.

Allowed filter fields: id, type, isRead, readAt, createdAt, updatedAt.

Response​

A list of Notification objects.

Example Request​

GET https://api.kojo.tech/notifications?limit=10&offset=20

Example Response​

[
{
"id": "ckz4a46kc0040xmoph9dbxret",
"type": "integration_issue_resolved",
"payload": {
"resolvedAt": "2022-02-08T19:56:17.309Z"
}
},
{
"id": "ckz4a46kc0040xmoph9dbxreu",
"type": "integration_issue_resolved",
"payload": {
"resolvedAt": "2022-02-08T19:56:17.309Z"
}
},
{
"id": "ckz4a46kc0040xmoph9dbxrev",
"type": "integration_issue_resolved",
"payload": {
"resolvedAt": "2022-02-08T19:56:17.309Z"
}
}
]

POST /notifications​

Creates a new notification.

Parameters​

NameTypeDescriptionExample
payloadNotificationPayloadAdditional parameters to this notification{lastSyncTime:"2021-02-02T00:00:00"}
recipientIdUserThe ID of the user that the notification was sent to"ckou4hq6f005f0862nxywk9ba"
typeNotificationTypeThe type of notificationintegration_issue

Response​

The created Notification.

Example Request​

POST https://api.kojo.tech/notifications
{
"recipientId": "ckou4hq6f005f0862nxywk9ba",
"type": "integration_issue",
"payload": { "lastSyncTime": "2021-02-02T00:00:00" }
}

Example Response​

{
"id": "cksev7kq401hk08289yzpfeqi",
"payload": {
"lastSyncTime": "2021-02-02T00:00:00"
},
"type": "integration_issue",
}

PATCH /notifications​

Updates notifications.

Parameters​

NameTypeDescriptionExample
id_inNotificationPayloadAdditional parameters to this notification{lastSyncTime:"2021-02-02T00:00:00"}
dataUpdateManyNotificationsDataInputUpdates to be applied to notificationsSee UpdateManyNotificationsDataInput
UpdateManyNotificationsDataInput​
NameTypeDescriptionExample
typeNotificationTypeThe type of notificationintegration_issue
payloadNotificationPayloadAdditional parameters to this notification{lastSyncTime:"2021-02-02T00:00:00"}
isReadbooleanIndicates whether notification has been readtrue
readAtDatetimeWhen notification was read"2021-03-14T15:92:65"

Response​

IDs of the updated Notifications.

Example Request​

PATCH https://api.kojo.tech/notifications
{
id_in: ["ckz4a46kc0040xmoph9dbxret","ckz4a46kc0040xmoph9dbxreu"],
data: {
type: WebNotificationTypesEnum.integration_issue_resolved,
payload: { resolvedAt: new Date().toISOString() },
}
}

Example Response​

["ckz4a46kc0040xmoph9dbxret","ckz4a46kc0040xmoph9dbxreu"]