The OneSignal integration is available on the [Pro](🔗) plan.
OneSignal can be a useful integration tool for understanding what stage a customer is in to react accordingly. RevenueCat can automatically update user tags in OneSignal with their latest subscription status.
With our OneSignal integration, you can:
Send an onboarding campaign to a user in a free trial
Send a push notification to churned users and [offer them a discount](🔗)
With accurate and up-to-date subscription data in OneSignal, you'll be set to turbocharge your campaigns ⚡️
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).
|`||The RevenueCat App User Id that triggered the event|
|`||The latest period type for the purchase or renewal. Either:
|`||epoch time in seconds of the latest subscription purchase or renewal|
|`||epoch time in seconds of the latest subscription expiration date|
|`||The latest event type from the user. Either:
|`||The latest subscription product identifier that the user has purchased or renewed|
|`||Comma separated string of RevenueCat Entitlement identifiers that the user unlocked|
|`||The value will be set to `|
|`||If a billing issue occurs we will send the date of the grace period expiration.|
Auto-renewing subscriptions only
RevenueCat only updates data tags in OneSignal in response to auto-renewing subscription events.
The OneSignal integration tracks the following events:
|Event||Default Event Name||Description||App Store||Play Store||Amazon||Stripe||Promo|
|Initial Purchase||initial_purchase||A new subscription has been purchased.||✅||✅||✅||✅||❌|
|Trial Started||trial_started||The start of an auto-renewing subscription product free trial.||✅||✅||✅||✅||❌|
|Trial Converted||trial_converted||When an auto-renewing subscription product converts from a free trial to normal paid period.||✅||✅||✅||✅||❌|
|Trial Cancelled||trial_cancelled||When a user turns off renewals for an auto-renewing subscription product during a free trial period.||✅||✅||✅||✅||❌|
|Renewal||renewal||An existing subscription has been renewed or a lapsed user has resubscribed.||✅||✅||✅||✅||❌|
|Cancellation||cancellation||A subscription or non-renewing purchase has been cancelled. See [cancellation reasons](🔗) for more details.||✅||✅||✅||✅||✅|
|Uncancellation||uncancellation||A non-expired cancelled subscription has been re-enabled.||✅||✅||✅||❌||❌|
|Expiration||expiration||A subscription has expired and access should be removed. If you have [Platform Server Notifications](🔗) configured, this event will occur as soon as we are notified (within seconds to minutes) of the expiration. If you do not have notifications configured, delays may be approximately 1 hour.||✅||✅||✅||✅||✅|
|Billing Issue||billing_issue||There has been a problem trying to charge the subscriber. This does not mean the subscription has expired. Can be safely ignored if listening to CANCELLATION event + cancel_reason=BILLING_ERROR.||✅||✅||✅||✅||❌|
# 1. Send device data to RevenueCat
The OneSignal integration requires some device-specific data. RevenueCat will only update users in OneSignal if the below data has been added as [Subscriber Attributes](🔗) for the user.
|`||The [OneSignal Player Id](🔗) for the user.||✅|
This property can be set manually, like any other [Subscriber Attributes](🔗), or through the helper method `
You can listen for changes to the OneSignal Id through their SDK, and send the value to RevenueCat. If you already have OneSignal set up, you should make sure that you're also sending the OneSignal Id for users that are updating to the latest version of your app.
# 2. Send RevenueCat events into OneSignal
After you've set up the _Purchases SDK_ to send device data to RevenueCat, you can "turn on" the integration and configure the tag names from the RevenueCat dashboard.
Navigate to your project in the RevenueCat dashboard and find the _Integrations_ card in the left menu. Select **+ New**
Choose **OneSignal** from the Integrations menu.
Add your **OneSignal App Id** and **OneSignal API key**.
Enter the tag names that RevenueCat should use, or choose the default tag names.
# 3. Testing the OneSignal integration
You can test the OneSignal integration end-to-end before going live. It's recommended that you test the integration is working properly for new users, and any existing users that may update their app to a new version.
## Make a sandbox purchase with a new user
Simulate a new user installing your app, and go through your app flow to complete a sandbox purchase.
## Check that the required device data is collected
Navigate the the [Customer View](🔗) for the test user that just made a purchase. Make sure that all of the required data from step 1 above is listed as attributes for the user.
## 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.
# Sample Events
Below are sample JSONs that are delivered to OneSignal for events.
Why are tags not working?
If your tags aren't working and RevenueCat is sending events successfully with 200 codes, check out [OneSignal's troubleshooting guide](🔗).
You've done it!
You should start seeing subscription data from RevenueCat appear on users in OneSignal.