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.
Requirements
- RevenueCat account
- RevenueCat Purchases SDK
- Understand RevenueCat-OneSignal integration
- OneSignal account with integrated SDK
- Understand Tags, Users, and OneSignal Subscriptions
Setup
Connect OneSignal to RevenueCat
- In your RevenueCat dashboard, navigate to your project settings and choose ‘OneSignal’ from the Integrations menu.
- Add your OneSignal App ID and OneSignal API key. See Keys and IDs for more information.
- 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. 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:
- User state observers:
- 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.
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 thelast_event_type tag.
- initial_purchase
- trial_started
- trial_converted
- trial_cancelled
- renewal
- cancellation
- uncancellation
- non_subscription_purchase
- subscription_paused
- expiration
- billing_issue
- product_change
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.