Push & Webhooks
Web push notifications via notifications.ocalt.com — one unified push service for all OQL-powered apps. Outbound webhooks for system-to-system events.
Architecture: Push subscriptions are stored in OQL's own infrastructure — no external service required. The notifications.ocalt.com portal handles browser permission consent on behalf of your app. Your users never need to configure anything.
| Verb | Description |
|---|---|
NOTIFY CHECK PUSH STATUS FOR ?uid SET ?bool | Check if a user has an active push subscription — returns boolean |
NOTIFY REQUEST PUSH GRANT FOR ?uid WITH "return_url" | Redirect the user's browser to the Ocalt notifications consent portal. On grant, redirects back to return_url. |
PUSH SUBSCRIBE ?sub AS ?uid SET ?ok | Register a raw PushSubscription object for a user identifier |
PUSH UNSUBSCRIBE ?uid SET ?n | Remove all push subscriptions for a user identifier — returns count removed |
NOTIFY "body" TO ?uid WITH "title" | Send a web push notification to all active subscriptions for the given user identifier |
WEBHOOK ?payload AT "url" | POST a JSON payload to a URL — returns boolean success |
Recommended flow
Check if the current user has push enabled. If not, redirect them to the consent portal. Once granted, send notifications freely.
SESSION !COOKIE(session) SET ?user
AFTER NOTIFY CHECK PUSH STATUS FOR ?user(id) SET ?has_push
AFTER IF ?has_push IS EQUAL TO false
OPEN NEST
NOTIFY REQUEST PUSH GRANT FOR ?user(id) WITH "https://myapp.ocalt.site/dashboard"
CLOSE NEST
Sending a notification
NOTIFY "Your order has shipped!" TO ?user(id) WITH "Order Update"
AFTER EMIT "Sent"
NOTIFY CHECK PUSH STATUS
Returns true if the user has at least one active push subscription, false otherwise.
NOTIFY CHECK PUSH STATUS FOR "user_42" SET ?active
AFTER EMIT ?active
NOTIFY REQUEST PUSH GRANT
Emits a 302 redirect to notifications.ocalt.com with your namespace and the user identifier. The portal requests browser permission, registers the service worker, stores the subscription, then redirects back to your WITH URL.
NOTIFY REQUEST PUSH GRANT FOR ?user(id) WITH "https://myapp.ocalt.site/home"
PUSH SUBSCRIBE — manual registration
For advanced use — if you handle the browser subscription yourself and want to register it directly.
PARSE JSON !REQUEST(body) SET ?sub
AFTER PUSH SUBSCRIBE ?sub AS ?user(id) SET ?ok
AFTER EMIT ?ok
PUSH UNSUBSCRIBE
PUSH UNSUBSCRIBE ?user(id) SET ?n
AFTER EMIT "Removed " & ?n & " subscriptions"
WEBHOOK — outbound event
NEW JSON OBJECT
OPEN NEST
SET "event" AS "payment.completed"
AND SET "user_id" AS ?uid
AND SET "amount" AS ?amount
AND SET "timestamp" AS !NOW
CLOSE NEST
SET ?payload
AFTER WEBHOOK ?payload AT "https://partner.example.com/hooks" SET ?ok
AFTER IF ?ok IS EQUAL TO true
OPEN NEST EMIT "Delivered" CLOSE NEST
ELSE OPEN NEST EMIT "Failed" CLOSE NEST