OneSignal

Sync Superwall subscription state to OneSignal user tags for messaging, segmentation, and Journeys.

In the Communication section within Integrations, you can connect your OneSignal app to Superwall.

Use this integration when OneSignal is your messaging or lifecycle marketing destination and you want subscription state available as OneSignal user tags.

Features

  • Subscription state tags: Updates OneSignal users with the latest Superwall subscription status.
  • Messaging segmentation: Use tags such as subscription_status, active_subscription, and product_id in OneSignal segments and Journeys.
  • Lifecycle context: Includes store, environment, purchase, expiration, transaction, project, and application details.
  • Sandbox controls: Sends sandbox events to a sandbox OneSignal app when configured, or skips them when sandbox credentials are blank.
  • Typed SDK attributes: iOS and Android SDKs expose typed OneSignal integration attributes for the OneSignal User ID.

Configuration

OneSignal requires an App ID and REST API key to update users through the OneSignal User API. Configure production credentials, and optionally configure sandbox credentials if you want sandbox subscription events to update a separate OneSignal app.

FieldDescription
OneSignal App IDYour production OneSignal app ID.
REST API keyYour production OneSignal REST API key.
Sandbox OneSignal App IDOptional. Used for sandbox events. If blank, sandbox events are skipped.
Sandbox REST API keyOptional. Used for sandbox events. If blank, sandbox events are skipped.
Test OneSignal User IDOptional. Used only by the dashboard validation action to update a known test user.

SDK Setup

Superwall updates OneSignal users after subscription events happen. To match those events to the correct OneSignal user, pass the OneSignal User ID to Superwall as soon as OneSignal makes it available.

If your app uses OneSignal external IDs, call OneSignal.login(...) before reading the OneSignal User ID.

iOS

// After OneSignal initializes and identity is set
if let oneSignalId = OneSignal.User.onesignalId {
    Superwall.shared.setIntegrationAttributes([
        .onesignalId: oneSignalId
    ])
}

Android

import com.superwall.sdk.models.attribution.AttributionProvider

// After OneSignal initializes and identity is set
OneSignal.User.onesignalId?.let { oneSignalId ->
    Superwall.instance.setIntegrationAttributes(
        mapOf(AttributionProvider.ONESIGNAL_ID to oneSignalId)
    )
}

Other SDKs

If your Superwall SDK does not yet expose a typed OneSignal integration attribute, set onesignalId as a user attribute instead.

Superwall.shared.setUserAttributes([
    "onesignalId": oneSignalId
])
Superwall.instance.setUserAttributes(
    mapOf("onesignalId" to oneSignalId)
)
await Superwall.shared.setUserAttributes({
  'onesignalId': oneSignalId,
});

Superwall also accepts $onesignalUserId, $onesignalId, oneSignalUserId, and onesignalUserId as raw user-attribute aliases, but onesignalId is the recommended key.

Tags

Superwall updates OneSignal user tags through the OneSignal User API.

TagDescription
app_user_idYour app's user identifier from the Superwall event.
period_typeSubscription period type, such as trial, intro, or normal.
purchased_atPurchase time as an ISO timestamp.
expiration_atExpiration time as an ISO timestamp, when available.
storeStore that produced the event, such as app_store, play_store, or stripe.
environmentproduction or sandbox.
last_event_typeOriginal Superwall event name.
superwall_event_typeNormalized Superwall event type, such as sw_subscription_start.
product_idProduct identifier from the purchase.
transaction_idTransaction identifier for the event.
original_transaction_idStore original transaction identifier, when available.
subscription_statusCurrent status inferred from the latest event.
active_subscriptiontrue when the latest event represents active access.
superwall_project_idSuperwall project ID.
superwall_application_idSuperwall application ID, when available.

Subscription Status

The subscription_status tag is designed for segmentation and Journey branching.

StatusWhen it is set
trialTrial started or trial uncancelled.
intro_offerIntro offer started or intro offer uncancelled.
activeSubscription start, renewal, uncancellation, product change, trial conversion, intro offer conversion, or non-renewing purchase.
cancelledTrial, intro offer, or regular subscription cancellation.
billing_issueBilling issue event.
pausedSubscription paused event.
expiredTrial, intro offer, or regular subscription expiration.
refundedRefund event.
testTest event.
unknownEvents that cannot be mapped to a subscription state.

active_subscription is true for active, trial, intro_offer, cancelled, and billing_issue statuses. A cancelled subscription can remain active until its expiration date, so it is still treated as active access.

Sandbox Handling

Sandbox events use the sandbox OneSignal App ID and REST API key. If either sandbox value is missing, Superwall skips sandbox events instead of sending them to your production OneSignal app.

Production events always use the production OneSignal App ID and REST API key.

Validation

The dashboard validation action requires a test OneSignal User ID. Validation sends a Superwall test event to that user and updates the same tags the integration uses for real events.

If you do not configure a test OneSignal User ID, validation fails without sending a request. Real subscription events can still be sent when they include onesignalId.

Troubleshooting

Tags are not updating in OneSignal

  1. Confirm the production OneSignal App ID and REST API key are configured.
  2. Confirm your app sends onesignalId to Superwall before subscription events occur.
  3. Confirm the value is the OneSignal User ID, not an external ID or push subscription ID.
  4. Confirm the user exists in the OneSignal app configured in Superwall.

Sandbox events are skipped

  1. Confirm both sandbox fields are configured.
  2. Confirm the sandbox REST API key belongs to the sandbox OneSignal app.
  3. Confirm the event environment is sandbox.

Validation fails

  1. Add a test OneSignal User ID in the integration settings.
  2. Confirm the test user exists in the selected OneSignal app.
  3. Confirm the REST API key has permission to update users.

References

How is this guide?

On this page