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"} |
| recipient | User | The users that the notification was sent to | See User docs |
| 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 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" |
Queries​
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 Query​
query {
notifications(limit: 3, filter: { type: integration_issue_resolved }) {
id
type
payload
}
}
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"
}
}
]
Mutations​
createNotification​
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 Mutation​
mutation {
createNotification(
recipientId: "ckou4hq6f005f0862nxywk9ba",
type: integration_issue,
payload: { lastSyncTime: "2021-02-02T00:00:00" }
) {
id
payload
type
recipient {
id
}
}
}
Example Response​
{
"id": "cksev7kq401hk08289yzpfeqi",
"payload": {
"lastSyncTime": "2021-02-02T00:00:00"
},
"type": "integration_issue",
"recipient": {
"id": "ckou4hq6f005b0862nxywk9ch"
}
}
updateNotifications​
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 |
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 Mutation​
mutation {
updateNotifications(
id_in: [ "ckz4a46kc0040xmoph9dbxret", "ckz4a46kc0040xmoph9dbxreu" ],
data: {
type: integration_issue_resolved,
payload: {resolvedAt: "2021-03-14T15:92:65"},
isRead: true,
readAt: "2021-03-14T15:92:65"
})
}
Example Response​
["ckz4a46kc0040xmoph9dbxret","ckz4a46kc0040xmoph9dbxreu"]