Features Pricing Services
Compare
Resources
Contact Start Free Trial
Home/Docs/Push Notifications

Push Notifications

Soryk uses push notifications () end-to-end. Notifications work natively in:

Overview

Browsers maintain a permanent subscription against your server. Soryk stores serialized subscriptions in Upstash, keyed by (shop, agent). When a triggering event happens, the server posts an encrypted message to the push endpoint with -signed headers. The browser wakes the, which displays the notification — even if the app isn't open.

secure push tech setup

You need three env vars:

VAPID_PUBLIC_KEY="BJL...your-public-key..."
VAPID_PRIVATE_KEY="abc...your-private-key..."
VAPID_SUBJECT="mailto:support@yourbrand.com"

Generate the keys

npx web-push generate-vapid-keys

Copy the public key into VAPID_PUBLIC_KEY and the private into VAPID_PRIVATE_KEY. Set VAPID_SUBJECT to a mailto: URL — push providers use it to contact you in case of abuse reports.

!

Don't rotate secure push tech casually. Subscriptions are tied to the public key. Rotating means every existing subscription becomes invalid and every agent has to re-subscribe.

Subscription flow

  1. Agent opens the app.
  2. Service worker (/sw.js) registers on first load.
  3. The PushRegistrar component checks Notification.permission:
    • granted → auto-creates a subscription via the public key endpoint.
    • default → does nothing yet. The toggle in Settings shows "Enable".
    • denied → toggle shows disabled state with link to browser instructions.
  4. Agent opens Settings → Notifications and taps the toggle. Browser prompts for permission. On grant → subscription is created and POSTed to /api/agent/push/subscribe.
  5. The serialized subscription is stored in Upstash set soryk:push:<shop>:<agent>.

Supported triggers

EventRecipientNotes
Public quote acceptedOriginating agentFires when a customer clicks Accept on a public quote link.
Public quote rejectedOriginating agentFires when a customer clicks Reject.
Discount approvedRequesting agentWhen admin approves a pending discount, the agent gets a push.
Discount rejectedRequesting agentSame, on rejection.
Refund commission alertAdmin (browser session)Optional — surface refund alerts to active admin sessions in real time.

Dead subscriptions (HTTP 404 / 410 from the push provider) are pruned automatically.

Disabling

From the agent's Settings → Notifications, toggle off. The subscription is removed from Upstash and the browser-side endpoint is unsubscribed.

To disable globally for all agents, unset the env vars. The send function becomes a no-op and the toggle hides itself in the UI (it checks the /api/agent/push/public-key response — empty string means no push).

iOS app caveat

!

iOS Safari requires the home-screen install. push notifications on iOS only works when the user has added the app to the home screen via the Share menu and is using iOS 16.4 or newer. In a regular Safari tab, push will not register — there's nothing we can do about that until Apple changes the platform.

For users on the native iOS app from the App Store, this isn't an issue — the app uses the same push notifications channel transparently.

iOS install instructions for your agents

  1. Open the app URL in Safari (must be Safari, not Chrome on iOS).
  2. Tap the Share button (square with arrow).
  3. Scroll and tap "Add to Home Screen".
  4. Open the app from the home screen icon (not from Safari).
  5. Sign in. Open Settings → Notifications. Tap the toggle. Grant permission.

Troubleshooting

Was this helpful?
Edit this page on GitHub