Saltar al contenido principal

Overview

RevenueCat helps you track in-app purchases and subscription lifecycles across platforms. With OneSignal, you can use this data to send personalized messages based on a user’s subscription status. This integration updates Tags in OneSignal automatically with their latest user info.

Key benefits

With the RevenueCat–OneSignal integration, you can:
  • Send onboarding messages to users in a free trial or who just subscribed.
  • Re-engage churned users with surveys or discounts.
  • Send transactional messages for purchases, billing issues, or renewals.
With accurate subscription data in OneSignal, your campaigns will be smarter and more effective.

Requirements


Setup

Connect OneSignal to RevenueCat

  1. In your RevenueCat dashboard, navigate to your project settings and choose ‘OneSignal’ from the Integrations menu.
  2. Add your OneSignal App ID and OneSignal API key. See Keys and IDs for more information.
  3. Enter the tag names that RevenueCat should use, or choose the default tag names.

Pass RevenueCat the OneSignal ID

RevenueCat uses the OneSignal user ID (OneSignal ID) to update Tags in OneSignal based on their RevenueCat user details.
Setting the External ID in OneSignal is required for a stable identifier. If it changes mid-session, the OneSignal ID may also change, breaking the RevenueCat connection.
To pass the OneSignal ID to RevenueCat, you should:
1

Set the External ID in OneSignal

Set the External ID in OneSignal to your main user ID. This can be done with the SDK login method.
2

Get the OneSignal ID

We recommend using the user state observer method to get the OneSignal ID, but we also provide getter methods:
3

Pass the OneSignal ID to RevenueCat

Pass the OneSignal ID to RevenueCat.
  • RevenueCat property: $onesignalUserId
  • RevenueCat helper method: setOneSignalUserID() (recommended)

Send RevenueCat events to OneSignal

Users that have a mapped OneSignal ID to RevenueCat will have their tags updated automatically.

Testing the integration

1

Make a sandbox purchase

Simulate a new user installing your app, and go through your app flow to complete a sandbox purchase.
Make sure the OneSignal ID is set in RevenueCat.
2

Check that the required device data is collected

In RevenueCat, navigate to the Customer View for the test user that just made a purchase. Make sure that all of the required data is listed as attributes for the user.
3

Check that the OneSignal event delivered successfully

While still on the Customer View, click into the test purchase event in the Customer History and make sure that the OneSignal integration event exists and was delivered successfully.
4

Check that the OneSignal tags are updated

In OneSignal, navigate to Audience > Users and search for the OneSignal ID. You should see the tags that were updated by RevenueCat.
Integration complete! You should now see the tags in OneSignal update automatically as users make purchases or update their subscription status.

RevenueCat event tags

For every auto-renewing subscription event in RevenueCat, the following tags get added or updated on the user in OneSignal. By leaving the tag blank in the RevenueCat dashboard, you can choose to not send any value for specific tag(s).
  • Auto-renewing subscriptions only
  • RevenueCat only updates Tags in OneSignal in response to auto-renewing subscription events.

RevenueCat event examples

Provided JSON examples show the tags sent to OneSignal based on RevenueCat Events. The event is saved as the last_event_type tag.

subscription_status tag

Whenever RevenueCat sends an event to OneSignal, a subscription_status tag is added or updated with any applicable changes, using one of the following values: For customers with multiple active subscriptions, this attribute will represent the status of only the subscription for which the most recent event occurred.

FAQ

How do I know if the integration is working?

In OneSignal, navigate to Audience > Users and search for the OneSignal ID. You should see the tags that were updated by RevenueCat. You can also go to Audience > Segments and create a segment that filters for the tags you have set via RevenueCat.

How many tags can I set?

There is no limit to the amount of tags you can set in OneSignal, but there is a limit to how many tags each user can have at a given time. See our Pricing page for more information.