Notifications
A notification is a message presented to a specific user in Kojo.
Schema​
Notification
​
Name | Type | Description | Example |
---|---|---|---|
id | ID | The unique notification ID | "ckmnpybisiy5x08abky4g2d1f" |
createdAt | DateTime | When this notification was created | "2021-03-24 17:26:46.983Z" |
payload | NotificationPayload | Additional parameters to this notification | {lastSyncTime:"2021-02-02T00:00:00"} |
type | NotificationType | The type of notification | integration_issue |
updatedAt | DateTime | When this notification was last modified | "2021-03-24 17:26:46.983Z" |
Enums​
NotificationType
​
Value | Description |
---|---|
integration_issue | There is an issue with an integration that requires some attention. |
integration_issue_resolved | An 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:
Value | Description | Example |
---|---|---|
lastSyncTime | The last time that contact was made with the integrated system. | "2021-03-14T15:92:65" |
order | Optional: 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:
Value | Description | Example |
---|---|---|
resolvedAt | The 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​
Name | Type | Description | Example |
---|---|---|---|
payload | NotificationPayload | Additional parameters to this notification | {lastSyncTime:"2021-02-02T00:00:00"} |
recipientId | User | The ID of the user that the notification was sent to | "ckou4hq6f005f0862nxywk9ba" |
type | NotificationType | The type of notification | integration_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​
Name | Type | Description | Example |
---|---|---|---|
id_in | NotificationPayload | Additional parameters to this notification | {lastSyncTime:"2021-02-02T00:00:00"} |
data | UpdateManyNotificationsDataInput | Updates to be applied to notifications | See UpdateManyNotificationsDataInput |
UpdateManyNotificationsDataInput
​
Name | Type | Description | Example |
---|---|---|---|
type | NotificationType | The type of notification | integration_issue |
payload | NotificationPayload | Additional parameters to this notification | {lastSyncTime:"2021-02-02T00:00:00"} |
isRead | boolean | Indicates whether notification has been read | true |
readAt | Datetime | When 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"]