WRNexusDocs
Theme
Accent color
Language

Mobile SDKs and branded inbox

Add a recipient inbox to your app with organization branding, unread counts, read/archive controls and custom actions.

Download the recipient inbox Postman collection

Recipient authentication

Your backend issues short-lived recipient tokens through Notifications. The clients call https://notifications.wrnexus.com/api/v1/inbox, or your verified custom domain. Keep business API keys on your server. The token provider runs before each request and stream reconnect.

Branding comes from the recipient API: display name, brand color and content-addressed logo. Messages render as text. Action links accept HTTPS URLs without credentials; custom actions go to your host callback.

Web · JavaScript 0.3.5 preview

Published to the WRNexus npm registry. Includes Apps, multi-channel sending and recipient push observations.

Install

npm install @wrnexus/sdk@0.3.5 --registry=https://registry.workroot.in/repository/npm/

Add the inbox

import Inbox from '@wrnexus/sdk/inbox';
import { mountInbox } from '@wrnexus/sdk/inbox-view';
const inbox = new Inbox({ token: () => yourBackend.fetchRecipientToken() });
const view = mountInbox(document.getElementById('notifications'), {
  client: inbox,
  onAction(message, action, url) { /* route URL or handle action.id */ },
});
// On logout, before signing in another recipient:
view.destroy();

Android · 0.1.0 preview

Published AAR, sources, POM and Gradle metadata. Android API 23+, compile SDK 35.

Install

repositories { maven { url 'https://registry.workroot.in/repository/maven-releases/' } }
dependencies { implementation 'com.wrnexus:wrnexus-inbox-android:0.1.0' }

Add the inbox

InboxClient inbox = new InboxClient(() -> yourBackend.fetchRecipientToken());
InboxView view = new InboxView(activity);
view.bind(inbox, (message, action, url) -> { /* route URL or handle action.id */ });
activity.setContentView(view);
// Host lifecycle: view.pause() / view.resume().
// Before logout: unregister this recipient's device, view.clear(), inbox.close().

iOS / SwiftPM · 0.1.0 preview

Published Git tag 0.1.0; public SwiftPM consumer verified. iOS 15+ / macOS 12+. Apple SDK compilation and device delivery remain acceptance checks.

Install

.package(url: "https://git.workroot.in/Clintchiz/WRNexus-Mobile-SDKs.git", exact: "0.1.0")

Add the inbox

import WRNexusInbox
let inbox = try InboxClient(token: { try await yourBackend.fetchRecipientToken() })
InboxView(client: inbox) { message, action in /* handle custom action.id */ }
// Before logout: unregister the recipient device, remove the view, inbox.close().

Flutter · 0.1.0 preview

Published Git tag 0.1.0; public Flutter consumer verified. Flutter 3.35+ / Dart 3.9+.

Install

dependencies:
  wrnexus_inbox:
    git:
      url: https://git.workroot.in/Clintchiz/WRNexus-Mobile-SDKs.git
      ref: 0.1.0
      path: flutter

Add the inbox

import 'package:wrnexus_inbox/wrnexus_inbox.dart';
final inbox = InboxClient(token: () => yourBackend.fetchRecipientToken());
WRNexusInboxView(client: inbox, onAction: (message, action, url) {
  /* route URL or handle action?.id */
});
// Place in a bounded-height parent, such as Scaffold.body.
// Before logout: unregister this recipient's device, dispose the view, inbox.close().

Connect your app

Open Notifications → Mobile push → Connected apps → Connect app in your organization. App connection permissions are required. Android uses Firebase; iOS uses your Apple push key. WRNexus stores the sending key encrypted on the server and sends through this connection.

  1. Android: upload the Firebase service-account JSON and choose Load apps. Select the Android app; WRNexus imports its project, Firebase App ID and package name. Enable the Firebase Management API and grant app-read access for discovery. If discovery is unavailable, upload the matching google-services.json instead. Sending still requires Firebase Cloud Messaging API access and the cloudmessaging.messages.create permission.
  2. iOS: upload your APNs .p8 key, enter Team ID and bundle ID; Key ID is imported from an AuthKey_XXXXXXXXXX.p8 filename. Optionally import the bundle ID from GoogleService-Info.plist. Select Sandbox for development builds or Production for TestFlight/App Store; use the setting that matches your Apple app build.
  3. After connecting your app, choose SDK setup to view the connection ID and registration/sending examples. Reconnecting an existing app updates its saved connection. Android access checks use FCM validation only and deliver no messages. Apple key checks verify its format; confirm delivery with a real device.

Firebase service accounts and Apple private keys stay on WRNexus servers. Never bundle them or business API keys in the mobile app. Client configuration files identify the app; they do not replace sending credentials.

Push and token rotation

Your app initializes the platform SDK, requests notification permission and obtains the device token. Persist a random installation ID in private app storage. Register the token with the connection ID, installation ID, platform, device name and the recipient's actual marketing consent/evidence. The recipient token and app connection must belong to the same organization and WRNexus environment.

When FCM or APNs rotates its token, register the new token using the same installation ID and a fresh recipient token. Retain the returned device ID per recipient. APNs Data tokens must be converted to lowercase hexadecimal. These SDKs do not silently request permission or collect consent.

Recipient · report device observations and read actions

// From actual FCM/APNs notification data. Never fabricate a receipt.
await inbox.reportMobileEvent({dispatchId: data.notification_id,
  deviceId: data.device_id, kind: 'received'});
// Report 'opened' only when the notification is opened.
// Report 'read' when the user explicitly marks it read. A linked inbox
// message is marked read too. The provider status stays Accepted.
// Native Android/Swift/Flutter integrations can POST the same body to
// /api/v1/inbox/mobile-events using their short-lived recipient token.
// When data.screen is present, route only to an allowlisted app screen.

Server · one logical app and several channels

import Notifications from '@wrnexus/sdk/notifications';
const client = new Notifications(); // Business key remains on your backend.
await client.notifications.appSend({appId, recipientId,
  channels: ['in_app', 'mobile_push'], title, body,
  purpose: 'transactional', category: 'orders', idempotencyKey: eventId,
  screen: 'orders/details', variables: {name: recipientName}});
// Selecting both channels links the push to the persistent inbox message.
// Apps can reuse Android + iOS connections, web push, email, SMS and WhatsApp.
// SMS and WhatsApp need approved content in a published notification template.

Android · register after login and token refresh

// Host app: initialize Firebase with google-services.json and request
// Android notification permission where required. Run off the UI thread.
// Call from FirebaseMessagingService.onNewToken and after login/getToken.
Models.DeviceResult device = inbox.registerMobilePush(
  new Models.MobileRegistration(connectionId, installationId,
    "Android", "android", fcmToken, false, "")
);
// Store device.id for this recipient; unregister it before logout.
// false is transactional-only. Use the user's actual choice for marketing.

iOS · register the native APNs token

// Host app: enable Push Notifications in Signing & Capabilities,
// request UNUserNotificationCenter authorization, then call
// UIApplication.shared.registerForRemoteNotifications().
// In didRegisterForRemoteNotificationsWithDeviceToken:
let apnsToken = deviceToken.map { String(format: "%02x", $0) }.joined()
let device = try await inbox.registerMobilePush(MobileRegistration(
  connectionId: connectionId, installationId: installationId,
  name: "iPhone", token: apnsToken, marketingConsent: false
))
// Call in an async Task after login; retain device.id for logout.
// Use an APNs hex token for an Apple connection, never an FCM token.

Flutter · use the token for the selected connection

// Host app owns Firebase/plugin initialization and permission prompts.
// For Android + Firebase connection: FirebaseMessaging.instance.getToken().
// For iOS + Apple connection: FirebaseMessaging.instance.getAPNSToken().
// Wait for a non-null token before registering; keep installationId stable.
final device = await inbox.registerMobilePush(MobileRegistration(
  connectionId: connectionId, installationId: installationId,
  name: deviceName, platform: platform,
  token: pushToken, marketingConsent: false,
));
// On token refresh and resume, get the platform's correct token again.
// onTokenRefresh yields an FCM token; do not pass it to an Apple connection.
// Keep device.id per recipient and unregister it before logout.

Server · send through the connected app

import Notifications from '@wrnexus/sdk/notifications';
// WRNEXUS_API_KEY stays on your server and binds organization permissions.
const client = new Notifications();
await client.notifications.mobilePushSend({
  connectionId, recipientId,
  idempotencyKey: eventId, category: 'app.update',
  purpose: 'transactional', content: { title, body, url },
});

Examples use host-app variables. Register after login and token refresh; unregister before changing accounts. Handle foreground display and notification taps in the host app, including cold starts. Push payloads include notification_id and an optional HTTPS url. Allow only your own approved URL hosts before navigating. notification_id identifies a push dispatch; it is not a branded-inbox message ID.

WRNexus sends visible alert notifications through the operating system. No polling loop or silent wake-and-fetch is needed for each alert. Inbox streaming runs while the app is active and resumes afterward. Mobile push does not automatically create a persistent inbox message; send an in-app notification separately when you need both, with its own usage charge. WRNexus Test simulates delivery; use Live and an opted-in test device to check real push.

Firebase Android setup · Apple APNs registration · Flutter messaging setup

Lifecycle and logout

Pause subscriptions when the view or app is inactive and reconnect after resume. Android exposes pause/resume; Flutter follows the app lifecycle; SwiftUI cancels its streaming task when inactive or removed. The web component follows document visibility.

Before logout unregister the recipient's device, clear or remove the view, cancel subscriptions and close the native client. If unregister fails, have your backend deactivate the device. Create a new client for each new recipient. Replacing a Flutter client clears previous recipient content; web destroy allows mounting a new recipient on the same host.

Client methods

All native clients provide messages, markRead, archive, preferences, savePreferences, devices, registerMobilePush, unregisterMobilePush, unregisterWebPush and streamed updates. Android calls stream updates subscribe; Swift and Flutter call them updates. Android blocking calls run off the UI thread, or through execute.

Errors preserve the API code and HTTP status. Writes are never automatically retried. Null quiet-hours and marketing-limit values clear saved rules; omitted fields preserve existing choices.

Local HTTP tests, UI tests and package downloads verify client behavior. They do not prove real FCM/APNs delivery. Apple SDK compilation, actual device delivery and production load checks remain separate acceptance work.

Server SDK guides · Notifications business API