Skip to content

Notifications

Business rules can send notifications through multiple channels using the notify() function from a script, or the send_notification action.

notify() takes a single recipient user ID and an options object:

notify(userId, {
title, // notification title
body, // notification body
channels, // optional: array of 'in_app', 'email', 'sms' (defaults to ['in_app'])
metadata // optional: extra data (e.g. { action_url: '/a/crm/t/leads/...' })
});

If no channels are specified, the notification is delivered in-app. When the channels include email or sms, oikapi looks up the recipient’s contact details automatically; channels with no contact info on file are skipped.

ChannelBackendDescription
in_appBuilt-inIn-application notifications
emailSMTPHTML and plain-text email
smsTwilioText messages

The platform can also deliver push notifications (APNs, FCM, and Web Push) through the notification system; push delivery is configured by superusers rather than addressed directly from the notify() channel list.

notify(record.assigned_to, {
title: 'Task assigned',
body: 'You have a new task: ' + record.title,
channels: ['in_app', 'email'],
metadata: { record_id: record.id, table: 'tasks' }
});
notifyRole('manager', {
title: 'Approval needed',
body: 'Order ' + record.id + ' is awaiting approval',
channels: ['in_app']
});

Send directly to an address (no user lookup):

sendEmail('ops@example.com', 'Order received', 'Order ' + record.id + ' was placed');
sendSMS('+15551234567', 'Your order shipped');

Rules can also send email or SMS without a script via the send_notification action, with field references interpolated from the record:

{
"type": "send_notification",
"config": {
"channel": "email",
"to": "$record.contact_email",
"subject": "Order $record.id received",
"body": "Thanks for your order."
}
}

Recipients can control how they’re notified: per-notification-type channel overrides, quiet hours (suppress or defer delivery during set times), and digests (batch lower-priority notifications instead of sending each individually).

Templates support HTML, plain text, and variable interpolation. Configure the email sender and SMS provider in server configuration.

Notifications are dispatched asynchronously in a detached goroutine after the triggering transaction commits, and delivery is recorded for each recipient. Failed deliveries retry with exponential backoff.