Sends a notification.
The notify()
function sends a notification to
the specified site contributors on the specified channels.
Use the channels
parameter to specify which channels to send the notification to.
Use the recipients
property of the options
parameter to specify which site
contributors to send the notification to.
function notify(
body: string,
channels: Array<string>,
options: NotificationOptions,
): Promise<void>;
Contents of the notification. Max length: 512 characters.
The channels to send the notification on. One or more of:
"Mobile"
: Sends the notification to the Wix App."Dashboard"
: Sends the notification to the contributor's Wix dashboard."Browser"
: Sends the notification to the contributor's browser.Additional notification related information.
import { Permissions, webMethod } from "wix-web-module";
import { notifications } from "wix-crm-backend";
export const notifyOwnerOnDashboard = webMethod(Permissions.Anyone, () => {
notifications.notify("Notification body", ["Dashboard"], {
title: "Notification Title",
actionTitle: "Click this!",
actionTarget: { url: "http://mysite.com/somepage" },
recipients: { role: "Owner" },
});
});
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.