WebToAppMaker

JavaScript Bridge

Identifying Users for Push

Attach a stable website account identifier to the device FCM token for targeted notifications.

Before you start

  • A signed-in website user
  • Firebase push enabled

Configure and verify

  1. Choose a safe identity

    Use an opaque stable ID such as customer-123 rather than a password, token, or sensitive personal value.

  2. Wait for website authentication

    Call the bridge only after the server has confirmed the user session.

  3. Register the identity

    Call webtoapp.setPushIdentity(identity). The app stores it locally and re-registers its FCM token.

  4. Target a test notification

    Send to Selected identity from the dashboard and verify only intended devices receive it.

  5. Define account switching

    Update identity after switching users. The current helper expects a non-empty identity; design logout handling before relying on shared devices.

Example

if (window.webtoapp && currentUser.id) {
  webtoapp.setPushIdentity(String(currentUser.id));
}

Test before release

  • Identity is opaque and stable
  • Call happens after login
  • Account switching updates it
  • Targeting was tested on shared devices