Requirements
- A Sendrealm Push App with the Web provider active.
- A React, Vite, or Next.js app served over HTTPS. Localhost works for development.
- The Sendrealm service worker served from the same origin as your app.
- A permission prompt triggered from a user gesture, such as clicking an Enable notifications button.
Activate The Web Provider
Open your Push App provider settings in the dashboard. The Web provider stores Sendrealm-managed VAPID keys. Copy the public key only if you need to inspect browser subscriptions manually; the React SDK receives it from/v1/init.
If keys are missing, click Activate provider. Use Regenerate keys only when you intentionally want browsers to create fresh subscriptions.
Install The SDK
Initialize React
autoRequestPermission false unless your UX already guarantees initialization runs from a user action. Browsers can block permission prompts that are not user-initiated.
init() is idempotent and safe under React StrictMode duplicate effects. The package also exports SendrealmProvider for advanced custom-client cases, but it is not required for normal React, Vite, or Next.js apps.
Add A Prompt Button
PushSubscription.toJSON() payload to Sendrealm and links it to the current device.
Link Signed-In Users
device_ids, contact_ids, external_ids, emails, audiences, or platforms: ["web"] from the API.
Next.js Notes
Callinit() from a Client Component and put the service worker file under public/.
<SendrealmInit /> once near your root layout or app shell.