Notifications
Notifications may be sent from a script.
Sending
import notifications from 'notifications'Define custom endpoints:
return notifications.send('c_axon_leave_study', {
var1: 'test1',
var2: 'test2'
}, {
endpoints: {
push: {
template: 'message as template {{var1}}',
apn: {
topics: [
'app',
'voip'
]
}
}
}
})Define custom HTML:
Send a predefined notification:
Send an empty notification:
Send a notification without a template or that is not predefined:
Send a Short Message Service (SMS) request to a custom mobile number using an existing template:
Send an SMS to a custom mobile number without a template:
Send an SMS to a custom mobile number without a template (example 2):
Send an SMS to a recipient without a template:
Push a mobile notification to a recipient using an existing template:
Push a mobile notification to a recipient using an existing template:
Send an email using an existing template:
Send an email with HTML and no template:
Send an email with a plain message and no template:
Legacy
send(name, variables, options)
Arguments
name{ String } Notification namevariables{ Object } Variables to be used in templatesoptions{ Object } [Optional]number{ String } Sender numberrecipient{ ObjectID, String } ObjectID from account or emailcontext{ Object }locale{ String } For example, 'en_US'apiKey{ String }count{ Number } If set, sets the badge on the device iconsound{ String } If provided, overrides the default soundapnTopics{ String [] }fcmTopic{ String [] }pushType{ String } Applies only for Apple Push Notification (APN)
send(payload, options)
Arguments
payload{ Object | String | Number } In case of string, used as payload only; if not, starts withc_ or __ or notin system notification namesoptions{ Object } [Optional]context{ Object }locale{ String } For example, 'en_US'apiKey{ String }endpoints{ Object }email{ Object }recipient{ ObjectID | String } ObjectID from account or emailtemplate{ String }message{ String } Plain text messagehtml{ String } HTML message
push{ Object }template{ String }message{ String }apn{ Object }topics{ String [] }pushType{ String }
fcm{ Object }topic{ String }
tpns{ Object }
sms{ Object }mobile{ String } Recipient phone numbernumber{ String } Sender numbermessage{ String }
Last updated
Was this helpful?