# RevenueCat new subscriber notifications on your phone > Get a push notification when a customer starts a subscription or free trial, on any store RevenueCat tracks. - Company: RevenueCat (https://www.justpush.io/recipes/revenuecat) - Event: `INITIAL_PURCHASE` (INITIAL_PURCHASE) - Tags: Finance, Subscriptions - Install: https://studio.justpush.io/recipes/revenuecat/initial-purchase - Web page: https://www.justpush.io/recipes/revenuecat/initial-purchase ## Setup 1. Click Install in Studio and sign in. The recipe is added to your account and you get a personal webhook URL. 2. In the RevenueCat dashboard, open your project's Integrations > Webhooks and add a new webhook. 3. Paste your webhook URL (shown in Studio after install) as the webhook URL. 4. Send all events, or only INITIAL_PURCHASE; the recipe ignores every other event type. 5. Save, then click Send test event to confirm it arrives. ## Code Studio calls `handleRequest(request)` with the incoming webhook (`{ method, headers, body, query, raw }`) and sends the message object it returns. Returning `null` sends nothing. ```js // RevenueCat โ†’ INITIAL_PURCHASE // Fires when a customer starts a subscription or free trial. // Docs: https://www.revenuecat.com/docs/integrations/webhooks/event-types-and-fields // // Paste this into a JustPush Studio integration and add a RevenueCat webhook pointing // at the integration's endpoint URL. // Human-readable store names. const STORES = { APP_STORE: "App Store", MAC_APP_STORE: "Mac App Store", PLAY_STORE: "Google Play", AMAZON: "Amazon", STRIPE: "Stripe", PADDLE: "Paddle", RC_BILLING: "Web Billing", ROKU: "Roku", PROMOTIONAL: "a promotional grant", TEST_STORE: "Test Store", } // RevenueCat prices are decimals ("9.99"), not cents. Returns null when there's no price. function money(amount, currency) { const value = Number(amount) if (amount == null || !Number.isFinite(value) || !currency) return null try { return new Intl.NumberFormat("en-GB", { style: "currency", currency }).format(value) } catch { return `${value} ${currency}` } } // Turn "NL" into ๐Ÿ‡ณ๐Ÿ‡ฑ. function flag(countryCode) { return /^[A-Z]{2}$/.test(countryCode ?? "") ? String.fromCodePoint(...[...countryCode].map((c) => 127397 + c.charCodeAt(0))) : "" } // "pro_monthly on App Store from jane@example.com ๐Ÿ‡ณ๐Ÿ‡ฑ (sandbox)" function where(event) { const attributes = event.subscriber_attributes ?? {} const who = attributes.$email?.value ?? attributes.$displayName?.value const store = STORES[event.store] ?? event.store return ( (event.product_id ?? "a product") + (store ? ` on ${store}` : "") + (who ? ` from ${who}` : "") + (flag(event.country_code) ? ` ${flag(event.country_code)}` : "") + (event.environment === "SANDBOX" ? " (sandbox)" : "") ) } function handleRequest(request) { const event = (request.body || {}).event // "Send test event" in RevenueCat; confirm the connection with a quiet push. if (event?.type === "TEST") { return { title: "๐Ÿ”” RevenueCat connected", message: "Test event received", topic: "RevenueCat", priority: -1 } } // Guard: only handle this event type, so other RevenueCat events on this integration stay quiet. if (event?.type !== "INITIAL_PURCHASE") { console.log(`Ignoring RevenueCat event "${event?.type ?? "unknown"}"`) return null } const trial = event.period_type === "TRIAL" const price = money(event.price_in_purchased_currency, event.currency) return { title: trial ? "๐Ÿงช Trial started" : "๐ŸŽ‰ New subscriber", message: (!trial && price ? `${price} for ` : "") + where(event), topic: "RevenueCat", priority: 0, // Normal โ€” good news, not an emergency ...(trial ? {} : { sound: "cashregister" }), } } ``` ## RevenueCat INITIAL_PURCHASE webhook payload (sample) ```json { "event": { "id": "CD489E0E-INITIAL-", "type": "INITIAL_PURCHASE", "price": 10.87, "store": "APP_STORE", "app_id": "app1a2b3c4d5", "aliases": [ "user_8Hq2" ], "currency": "EUR", "product_id": "pro_monthly", "app_user_id": "user_8Hq2", "environment": "PRODUCTION", "period_type": "NORMAL", "country_code": "NL", "transaction_id": "2000000712345678", "entitlement_ids": [ "pro" ], "purchased_at_ms": 1790584200000, "expiration_at_ms": 1793176200000, "event_timestamp_ms": 1790584200000, "subscriber_attributes": { "$email": { "value": "jane@example.com", "updated_at_ms": 1790584100000 } }, "original_transaction_id": "2000000612345678", "price_in_purchased_currency": 9.99 }, "api_version": "1.0" } ``` ## FAQ ### Does this work on iPhone and Android? Yes. Install the JustPush app from the App Store or Google Play and sign in. Every phone signed in to your account gets the notification. ### Do I need to write code? No. Install the recipe in Studio, paste your webhook URL into RevenueCat and you are done. The code is there if you want to change the text, the sound or the buttons. ### Can I change what the notification says? Yes. After install the recipe's code is yours. Edit it in Studio and test it against the sample payload before you save. ### What does it cost? JustPush is free for 30 days. After that it's $19.99 a year, or $39.99 once. There is no extra charge for recipes.