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"}
recipientUserThe users that the notification was sent toSee User docs
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 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"

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​

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 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​

NameTypeDescriptionExample
id_inNotificationPayloadAdditional parameters to this notification{lastSyncTime:"2021-02-02T00:00:00"}
dataUpdateManyNotificationsDataInputUpdates to be applied to notifications
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 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"]