import notifications from 'notifications';
Methods
send(name, variables, options)
send(name, variables, options)
Sends a custom notification to a single recipient.
Arguments
name
(String) the api name of the notification template.variables
(Object) an object matching the variables in the matching notification handlebars template(s).options
context
(Object) a context object is required for persistent notifications to provide subject instance context._id
(ObjectId)object
(String)
locale
(String:en_US)recipient
(ObjectId|Email:script.principal._id) A custom recipient. Defaults to the script's calling principal.apiKey
(String) An optional app key (eg. K0yscrO53AZqpisMmf0Nco), used to pin APNs/GCM push notifications to a single app.number
(String) a custom sending phone number for sms notifications. The phone number must be pre-configured in the administration interface under Settings -> Notifications.
Examples
// example 'after sign-in' script that notifies a list of account holders of all logins.
import notifications from 'notifications'
['[email protected]', '[email protected]'].forEach((recipient) => {
notifications.send('c_login_notify', { message: "hello there!" }, {recipient: recipient})
})