Search...
notify( )
Sends a notification.
Description
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.
Syntax
function notify(body: string, channels: Array<string>, [options: NotificationOptions]): Promise<void>
notify Parameters
NAME
TYPE
DESCRIPTION
body
string
Contents of the notification. Max length: 512 characters.
channels
Array<string>
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.
options
Optional
NotificationOptions
Additional notification related information.
Returns
Fulfilled - When the send notification request is received.
Return Type:
Promise<void>
Was this helpful?
Send a notification to the site owner's Dashboard
Copy Code
1import { Permissions, webMethod } from 'wix-web-module';2import { notifications } from 'wix-crm-backend';34export const notifyOwnerOnDashboard = webMethod(Permissions.Anyone, () => {5 notifications.notify(6 "Notification body",7 ["Dashboard"],8 {9 "title": "Notification Title",10 "actionTitle": "Click this!",11 "actionTarget": { "url": "http://mysite.com/somepage" },12 "recipients": { "role": "Owner" }13 }14 );15});
Send a notification to the site owner on multiple channels (browser and mobile)
Copy Code
1import { Permissions, webMethod } from 'wix-web-module';2import { notifications } from 'wix-crm-backend';34export const notifyMultipleChannels = webMethod(Permissions.Anyone, () => {5 notifications.notify(6 "Notification body",7 ["Browser", "Mobile"],8 {9 "title": "Notification Title",10 "actionTitle": "Click this!",11 "actionTarget": { "url": "http://mysite.com/somepage" },12 "recipients": { "role": "Owner" }13 }14 );15});
Send a notification to all site contributors on mobile
Copy Code
1import { Permissions, webMethod } from 'wix-web-module';2import { notifications } from 'wix-crm-backend';34export const notifySiteContributors = webMethod(Permissions.Anyone, () => {5 notifications.notify(6 "Notification body",7 ["Mobile"],8 {9 "title": "Notification Title",10 "actionTitle": "Click this!",11 "actionTarget": {"url": "http://mysite.com/somepage"},12 "recipients": { "role": "All_Contributors"}13 }14 );15});