Introduction
lerix.notifications is a typed client for the
push notifications REST API. A common
setup is a Supabase Database Webhook that calls an edge function, which
pushes to the users affected by the change.
Configure
notifications.projectId defaults to the SDK’s projectId. Set it when your
functions report to one project and your mobile app lives in another.
Example: push when an order ships
Create a Database Webhook onUPDATE of orders that calls this function:
supabase/functions/order-status-push/index.ts
externalUserIds are your own user ids, as passed to setUser() in the
client SDKs. One send reaches every device the user is signed in on, on every
platform. See Users & Identity.
Send
The result has the
notificationId. For externalUserIds sends it also has
matchedUsers, matchedDevices and unknownUserIds (users with no device
yet, which is not an error).
Update, unsend, cancel, deliveries
LerixApiException with the backend’s code and status.
Identity verification
When the project requires identity verification, eachsetUser() call needs
an identityHash computed on your server. An edge function is a good place
for it: