Skip to content

Powered by Grav CMS + Helios Theme

Notifications

The registry of merchant notifications, and switching one on or off.

Every notification KahunaCart or an add-on can send a merchant, with its channel and whether it is on, and where new store-owner messages go until a message has channels of its own. See Merchant notifications.

List the store's notifications

GET /api/v1/kahunacart/notifications-registry Permission kahunacart.settings

Every email the store can send — the base plugin's own and any an add-on registers — with whether it is switched on, the template pair it renders from, the shipped pair it can be restored to, who it goes to and what triggers it, plus the template pairs a notification may be pointed at. No notification can be deleted; a merchant switches one off or points it at another template.

Switch a notification on or off, or re-point its template

PATCH /api/v1/kahunacart/notifications-registry Permission kahunacart.settings

Change one notification by code. enabled switches it; template points it at another shipped or theme template pair by basename; restore points it back at the pair it shipped with. Only what is present changes. Refused with 422 for a template that does not exist or a notification that has no template of its own.

Parameters

Name Type Description
code required string The notification code, e.g. order.shipped
enabled optional boolean Whether the message goes out at all
template optional string A template basename under templates/emails/, e.g. shipped-brand
restore optional boolean True points the notification back at its shipped template
channels optional array of string Store-owner messages only: the ids of the channels this message goes to. An empty list sends it nowhere. Refused with 422 on a message that goes to the customer, and on the store copy of the confirmation, which goes to the address in the Emails settings.
priority optional string Store-owner messages only: how loudly this arrives on a phone. Pushover, ntfy and Gotify use it; email, text messages and the chat services ignore it. An empty string restores the shipped priority.
One of: low, normal, high, emergency
use_default optional boolean Store-owner messages only: true sends the message back to the store default channels (set_default_notification_channels), forgetting its own list. Cannot be sent together with channels.

List the places the store owner is notified

GET /api/v1/kahunacart/notification-channels Permission kahunacart.settings

Every channel the store can reach its owner on — email, Slack, Discord, Telegram, Pushover, ntfy, Gotify, a text message through Textbelt or Twilio or a webhook of your own — with its id, its kind and what it is called, plus the fields each kind asks for. The ids are what update_notification ticks on a store-owner message. Secrets are never included: a token comes back as a fixed mask. Channels set up in the config file are listed too, marked as coming from there; those go by the events they list rather than by a tick.

Choose where new store-owner messages go

PUT /api/v1/kahunacart/notification-channels/default Permission kahunacart.settings

Set the channels every store-owner message goes to until its own channels are saved — "New messages go to" on the Channels page. A message whose channels were saved with update_notification keeps its own list; one sent back with use_default follows this again. The ids come from list_notification_channels and must be channels added on the Channels page: a channel from the config file goes by its own events list. An empty list is a choice: new messages go nowhere. Answers the default as it now stands.

Parameters

Name Type Description
channels required array of string Channel ids from list_notification_channels; an empty list sends new messages nowhere

Add a notification channel

POST /api/v1/kahunacart/notification-channels Permission kahunacart.settings

Create a channel of one type (email, slack, discord, telegram, pushover, ntfy, gotify, textbelt, twilio or webhook) with its fields. Secrets are encrypted at rest. use_for_new adds it to where new messages go, and left out it is true for the store's first channel only. An email channel's addresses can be a string or a list. No tool: it handles a bot token or a webhook secret, which stays with the person who has it.

Update a notification channel

PATCH /api/v1/kahunacart/notification-channels/{id} Permission kahunacart.settings

Change a stored channel's label, fields or enabled flag. A secret field left as the mask keeps what is stored. A channel that comes from config cannot be edited here.

Remove a notification channel

DELETE /api/v1/kahunacart/notification-channels/{id} Permission kahunacart.settings

Delete a stored channel and untick it from every store-owner message and from where new messages go. The messages themselves keep their other channels.

Send a test to one channel

POST /api/v1/kahunacart/notification-channels/{id}/test Permission kahunacart.settings

Record a notification.test event addressed to this one channel and run it through the queue and dispatcher straight away, answering the transport's own error when it fails. No tool: it puts a real message on somebody's phone or in a chat room.