Audiorista uses several third-party systems to handle users and subscriptions. Your marketing, support or other functions may wish to sync the available customer data with existing systems on your end - CRMs, email sending platforms etc.
Data sources
There are multiple ways to go about this, and the best one to choose usually depends on your exact needs. To begin with, let's take a look at the main data sources available.
Firebase Auth
Our most common login solution, unless you're using our Web Auth.
- Customer data typically includes email (not always when using social auth providers) and sometimes name (depending on provider)
- Does not offer webhooks out of the box, but the same can be achieved using Firebase Cloud Functions
App Store
Handles in-app purchases and subscriptions on Apple devices.
- Does not offer any easy export functionality
- Does not display customer data
Google Play
Handles in-app purchases and subscriptions on Android devices.
- Does not offer any easy export functionality
- Does not display customer data (although you can search by email)
Stripe
Handles purchases and subscriptions on the web.
- Offers exports from the dashboard as well as webhooks that can be used to sync data to third parties
- Customer data typically includes name and email
RevenueCat
Ties the other solutions together - the login data from Firebase Auth and the customer data from App Store, Google Play and Stripe.
- Offers exports from the dashboard as well as webhooks that can be used to sync data to third parties
- Customer data can include email if this is enabled on Audiorista
Firebase Firestore
Used by Audiorista to hold user-generated data (bookmarks, favorites, listening history etc.)
Both Stripe and RevenueCat data can be synced to Firestore using Firebase Extensions, but this does not offer any real advantage over using both solution's webhook functionality unless the data needs to be used by another Firebase Extension or Cloud Function.
Recipes
As mentioned in the beginning, which syncing solution to choose depends on your exact needs. Let's take a look at the most common scenarios.
For projects using Web Auth
If you're using your existing login solution (Wordpress/Auth0 etc.), this is your source of truth and the best place to export data from.
For projects using Firebase Auth and no paywall
If you're using Firebase Auth without a paywall, most of your relevant data will be concentrated in the Firebase Auth database.
This can be exported on-demand using the Firebase command line interface (CLI) using the auth:export
command.
Read more here: https://firebase.google.com/docs/cli/auth
You can also set up a Cloud Function triggered by functions.auth.user().onCreate()
event handler.
Read more here: https://firebase.google.com/docs/functions/auth-events
Firebase Auth with Stripe paywall (no in-app purchases)
If you're using Firebase Auth and Stripe as your only paywall, then you can use Stripe's excellent developer tools, such as webhooks, for syncing data. Typically you will want to listen for events such as customer.created
and customer.subscription.created
.
Read more here: https://docs.stripe.com/webhooks
For even more ease of use, you can use Zapier for connecting Stripe data to other services. Many CRMs and email sending platforms also have existing integrations with Stripe.
Read more here: https://zapier.com/apps/stripe/integrations
Firebase Auth with multi-platform paywall
If you're using Firebase Auth with support for in-app subscriptions (and optionally Stripe), RevenueCat is the source that combines most of the customer data. Typicall you will want to listen for events such as INITIAL_PURCHASE
and inspect the period_type
attribute to see whether the customer is trialing.
Read more here: https://www.revenuecat.com/docs/integrations/webhooks
As their documentation explains, the simplest flow is to fetch the current customer data on every webhook. Note that the app_user_id
matches the Firebase Auth UID
.
Read more here: https://www.revenuecat.com/docs/api-v1#tag/customers/operation/subscribers
If you are using the RevueCat Firebase Extension, this data will also be available in Firebase Firestore under /users/{uid}/revenuecat/{uid}
. Relevant fields to look at are the entitlements
(if you need to know the access level) and subscriptions
(if you need to know details about the store and period).
Hybrid solutions
Nothing is stopping you from mixing and matching the above solutions if you have specific needs that aren't being met by any single one.