Skip to main content

OneSignal

OneSignal is a leading customer engagement platform offering push notifications, email, SMS, and in-app messaging. Integrating Adapty with OneSignal enables you to access all your subscription events in one place, allowing you to trigger automated communication based on those events.

With Adapty, you can track subscription events across multiple stores, analyze user behavior, and use that data for more targeted communication. This integration helps you monitor subscription events within your OneSignal dashboard and map them to your acquisition campaigns.

Adapty updates OneSignal tags based on subscription events, enabling you to deliver personalized push notifications with minimal setup.

Integration characteristics

Integration characteristicDescription
ScheduleReal-time updates
Data directionOne-way: from Adapty to OneSignal server
Adapty integration point
  • OneSignal and Adapty SDKs in the mobile app code
  • Adapty server

Setting up One Signal integration

To set up the integration:

  1. Open Integrations → OneSignal in your Adapty Dashboard.

  2. Enable the integration toggle.

  3. Enter your OneSignal App ID.

To set up the integration with OneSignal, go to Integrations -> OneSignal in your Adapty dashboard, turn on a toggle, and configure the integration credentials.

Retrieving your OneSignal App ID

Find your OneSignal App ID in your OneSignal Dashboard:

  1. Navigate to SettingsKeys & IDs.

  2. Copy your OneSignal App ID and paste it into the App ID field in the Adapty Dashboard.

You can find more information about the OneSignal ID in the following documentation.

Configuring events

Adapty allows you to send three groups of events to OneSignal. Toggle on the ones you need in the Adapty Dashboard. You can view the complete list of available events with detailed description here.

Adapty sends subscription events to OneSignal using a server-to-server integration, allowing you to track all subscription-related activity in OneSignal.

warning

Starting April 17, 2023, OneSignal's Free Plan no longer supports this integration. It is available only on Growth, Professional, and higher plans. For details, see OneSignal Pricing.

Custom tags

This integration updates and assigns various properties to your Adapty users as tags, which are then sent to OneSignal. Refer to the list of tags below to find the ones that best fit your needs.

warning

OneSignal has a tag limit. This includes both Adapty-generated tags and any existing tags in OneSignal. Exceeding the limit may cause errors when sending events.

TagTypeDescription
adapty_customer_user_idStringThe unique identifier of the user in your app. It must be consistent across your system, Adapty, and OneSignal.
adapty_profile_idStringThe Adapty user profile ID, available in your Adapty Dashboard.
environmentStringSandbox or Production, indicating the user’s current environment.
storeStringStore where the product was bought. Options: app_store, play_store, stripe, or the name of your custom store.
vendor_product_idStringThe product ID in the app store (e.g., org.locals.12345).
subscription_expires_atStringExpiration date of the latest subscription (YYYY-MM-DDTHH:MM:SS+0000, e.g., 2023-02-10T17:22:03.000000+0000).
last_event_typeStringThe latest event type from the Adapty event list.
purchase_dateStringLast transaction date (YYYY-MM-DDTHH:MM:SS+0000, e.g., 2023-02-10T17:22:03.000000+0000).
active_subscriptionStringtrue if the user has an active subscription and false if the subscription has expired.
period_typeStringIndicates the most recent period type for the purchase or renewal. Possible values: trial for a trial period or normal for all other cases.

All float values are rounded to integers. The strings remain unchanged.

In addition to the predefined tags, you can send custom attributes as tags, providing greater flexibility in the data you include. This is useful for tracking specific details related to your product or service.

Custom user attributes are automatically sent to OneSignal if the Send user attributes checkbox is enabled on the integration page. When unchecked, Adapty sends exactly 10 tags. If checked, more than 10 tags can be sent, allowing for enhanced data capture.

SDK configuration

There are two ways to integrate OneSignal with Adapty:

  1. Legacy (pre-v5): Uses playerId (deprecated in OneSignal SDK v5).
  2. Current (v5+): Uses subscriptionId.
warning

Make sure to send playerId (for OneSignal SDK pre-v5) or subscriptionId (for OneSignal SDK v5+) to Adapty. Without this, OneSignal tags won’t be updated, and the integration won’t function properly.

// SubscriptionID
OneSignal.Notifications.requestPermission({ accepted in
Task {
try await Adapty.setIntegrationIdentifier(
key: "one_signal_subscription_id",
value: OneSignal.User.pushSubscription.id
)
}
}, fallbackToSettings: true)

Read more about OSSubscriptionObserver in the OneSignal documentation.

Dealing with multiple devices

If a user has multiple devices, tracking purchase events and subscriptions can be challenging. OneSignal provides a way to handle this through external user IDs.

To keep user data consistent across devices:

  1. Match different devices on your server side and send this data to OneSignal.
  2. Use Adapty’s customer_user_id as an externalUserId in OneSignal. If your app doesn't have a registration system, consider using another unique identifier that remains consistent across the user's devices.

It's important to maintain consistency in the user identifier across all devices and update OneSignal whenever a user's ID changes. This simplifies tracking user activity and subscriptions while ensuring consistent messaging and allows for more accurate analytics and a better user experience. For more details, see OneSignal's external user ID documentation.