OneSignal
Last updated
Last updated
© Purchasely 2020-2023
The minimal version of the Purchasely SDK supporting this integration is v3.2.0. If the Purchasely SDK integrated in your app is under the minimal version, please update it.
The OneSignal SDK also needs to be integrated inside the app.
OneSignal is one of the leading customer engagement solutions for Push Notifications, Email, SMS & In-App.
This integration will allow you to get all Purchasely subscription events to OneSignal making you able to trigger automated communication based on those events, messages that could be linked to a Purchasely powered paywall to engage, upsell, retain customers.
Purchasely provides a unified dataset to track the subscription events for all stores. These events are generated by the Purchasely Backend and your OneSignal users' can be updated accordingly.
Subscription events generated by Purchasely will be sent to OneSignal using a server-to-server integration. As a result, you will be able to see all the subscription events in your OneSignal Dashboard and map them with your acquisition campaigns.
The following events are the main ones that will trigger an udpate of your OneSignal users by Purchasely. See the full list here.
Event | Description |
---|---|
SUBSCRIPTION_STARTED | Sent when the user purchased a product wether it is the start of a trial or a regular purchase of a consumable product. |
SUBSCRIPTION_RENEWED | Sent when a subscription renews |
SUBSCRIPTION_EXPIRED | Sent when the subscription actually ends |
SUBSCRIPTION_REACTIVATED | Sent when an expired subscription is reactivated. This event is particularly useful for win-back & retargeting campaigns |
SUBSCRIPTION_REFUNDED_REVOKED | Sent when the subscription actually ends |
RENEWAL_DISABLED | Sent when the user deactivates the renewal of a subscription wether it is in trial period or not. |
RENEWAL_ENABLED | Sent when the user reactivates |
TRIAL_STARTED | Sent when a trial starts |
TRIAL_CONVERTED | Sent when a user converts from a free trial to a normal paid-period |
TRIAL_NOT_CONVERTED | Sent when a user finishes it's trial period without renewing to a paid-period |
The following properties are the main ones this integration can set and update in your OneSignal users as tags:
Property | Description |
---|---|
USER_ID | Contains the user_id that holds the purchase. |
PLAN | Contains the Plan id that was bought. |
SUBSCRIPTION_STATUS | Filled for events that regards a subscription. Possible Values :
|
STORE | Contains the name of the Store through which the purchase was made. Possible values:
|
STORE_COUNTRY | Contains the store country where the purchase was made. |
PURCHASED_AT | Contains the date of the last transaction (original purchase or renewal). |
NEXT_RENEWAL_AT | Contains the next automatic renewal date**.** |
OFFER_TYPE | Contains the current offer the subscription is under. Possible values:
|
GRACE_PERIOD_EXPIRES_AT | Contains the date when the grace period will end. |
LAST_EVENT | Name of the last event received for that subscription |
IS_FAMILY_SHARED | Contains true or false depending on if the user has access to the subscription thanks to family sharing. |
OFFER_IDENTIFIER | Contains the promo code used at the time of the purchase. |
ORIGINAL_PURCHASED_AT | Contains the date of the first transaction. |
The properties' names set in OneSignal can be overriden when setting up the integration.
The integration requires 2 steps:
Associate the user to events by providing the OneSignal Player ID
to the Purchasely SDK
Activate the OneSignal integration in the Purchasely Console
See the OneSignal Documentation for more information
The activation requires 2 steps:
Retrieving your app id and API key in the OneSignal Dashboard
Enabling the OneSignal integration in the Purchasely Console
Log into your OneSignal dashboard: https://app.onesignal.com/login
Access your App
3. Got to your App's Settings
4. Access the "Keys" submenu
5. Your app’s app id is beneath the OneSignal App ID
title
6. Your app's API key is beneath the Rest API Key
title
Go in the "External integrations" section, and open the edition form for OneSignal:
2. Enable the integration
3. Set your OneSignal app id
4. Set your OneSignal app API key
5. Enable the properties you want to be set and updated as OneSignal tags
for your users
6. (Optional) Override the property names that will be used when updating your users' OneSignal tags
7. Save
To test your integration, you can perform a set of in-app purchases in a Sandbox environment (eg: TestFlight for the App Store) and verify your user's tags
are properly updated in the OneSignal dashboard (https://app.onesignal.com/login).
If testing using Automated Messages, bear in mind that OneSignal automated messages are sent roughly every 4-6 hours if you are on a free plan, and within a few minutes if you are on a paid plan.