Search.../

notify( )

Developer Preview

Sends a notification.

Description

The notify() function sends a notification to the specified recipients on the specified channels.

List the the channels for the notification in the channels parameter .

List the recipients for the notification in the toContacts, toSiteContributors, and toTopicsSubscribers parameters.

Syntax

function notify(body: string, channels: Array<string>, options: NotifyOptions): Promise<void>

notify Parameters

NAME
TYPE
DESCRIPTION
body
string

The body of the notification.

Max: 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
NotifyOptions

Notification options.

Returns

Fulfilled when the send notification request is received.

Return Type:

Promise<
void
>

Was this helpful?

notify example

Copy Code
1import { notifications } from 'wix-notifications.v2';
2
3 async function notify(body, channels, options) {
4 try {
5 const result = await notifications.notify(body, channels, options);
6
7 return result;
8 } catch (error) {
9 console.error(error);
10 // Handle the error
11 }
12 }
13