Notifications
Push, persistent, email and SMS, and letting the installer choose recipients.
| Function | Delivered | Notes |
|---|---|---|
sendPushNotification(message, title?, critical?, userIds?) | phones of the account's users | critical: true = time-sensitive (prompt under Focus); never bypasses Do Not Disturb |
sendPersistentNotification(message, title?) | the app's notification centre | stays until dismissed |
sendEmail(to, subject, body) | email via the cloud | fire-and-forget |
sendSms(to, message) | SMS via the cloud | US 10-digit numbers |
All four are fire-and-forget: they return immediately and failures are logged on the hub. They need the hub to be online; everything else in a smart app runs without the cloud.
function onLeak(evt) {
sendPushNotification(`Water detected at ${evt.newState.attributes?.friendlyName ?? evt.entityId}`, 'Leak', true);
sendPersistentNotification('A leak sensor tripped. Check the utility room.', 'Leak');
}Choosing recipients
Let the installer pick people instead of hard-coding addresses:
{ key: 'recipients', label: 'Notify', type: 'accountUserId', multiple: true },
{ key: 'emailTo', label: 'Email', type: 'accountUserEmail' },These input types are not hydrated as globals; read them from settings:
sendPushNotification(message, 'Security', false, settings.recipients);
if (settings.emailTo) sendEmail(settings.emailTo, 'Alarm', message);The cloud rejects user ids that do not belong to the hub's account.
Rate and content
There is no per-app quota, but every push interrupts a person. Debounce noisy sensors with
runIn, batch summaries with a daily schedule, and keep
personal data out of messages (they transit the cloud and may appear on lock screens).
sendEmail, sendSms and httpRequest are not available to AI-generated user automations; your
own registered apps can use them.