ReferralPanda Docs

Screen schema

A referral screen is a small JSON document. You normally build it in the dashboard editor, but you can also create and publish screens through the API. Every ReferralPanda SDK draws the same document the same way.

{ "schemaVersion": 1, "defaultLocale": "en", "strings": { "en": { "title": "Give a friend {{reward.referee.label}}", "share": "Share your link" }, "es": { "title": "Regala {{reward.referee.label}}" } }, "theme": { "colors": { "background": { "light": "#FFFFFF", "dark": "#0A0A0A" }, "surface": { "light": "#F5F5F5", "dark": "#171717" }, "text": { "light": "#0A0A0A", "dark": "#FAFAFA" }, "muted": { "light": "#666666", "dark": "#A3A3A3" }, "primary": { "light": "#0A0A0A", "dark": "#FAFAFA" }, "on_primary": { "light": "#FFFFFF", "dark": "#0A0A0A" }, "border": { "light": "#E5E5E5", "dark": "#262626" }, "success": { "light": "#15803D", "dark": "#4ADE80" } }, "radius": 16 }, "root": { "type": "scroll", "children": [ { "type": "text", "text": "title", "style": "title" }, { "type": "code_box" }, { "type": "share_button", "label": "share" } ] } }

Components

stackLays children out in a column or a row, with spacing, padding and alignment.
scrollA scrolling column. Only as the root of a screen.
cardA rounded surface around its children.
spacerEmpty space from the spacing scale.
textA string, as a title, heading, body or caption.
imageAn uploaded image, with an aspect ratio and fit.
lottieAn uploaded Lottie animation.
iconOne of 16 built-in icons.
code_boxThe person's referral code. Tap to copy.
share_buttonOpens the share sheet, or one channel directly.
channel_rowA row of share channels: Messages, WhatsApp, copy link, more.
progressMilestones against a stat, for example "3 friends unlocks a free year".
reward_listThe person's rewards, pending and issued.
stats_rowUp to four numbers: total, pending, qualified, rewarded.
redeem_code_inputA field to enter a friend's code.
offer_code_redeem_buttoniOS only. Opens Apple's sheet for an offer code the person earned.

Strings and translation

Text is never written on a component. A component names a key, and strings holds the text for each locale. The default locale must have every key. Other locales can be partial: a missing string falls back to the same language without a region (pt-BR to pt), then to the default locale.

Tokens

Strings can include these values. A token that is not in this list is refused when you save, and a token with no value is left out, so braces never reach your users.

{{referral.code}}The person's code.
{{referral.link}}The person's share link.
{{stats.total}}Friends they have referred.
{{stats.pending}}Referrals that have not qualified yet.
{{stats.qualified}}Referrals that qualified.
{{stats.rewarded}}Referrals they were rewarded for.
{{reward.referrer.label}}What the referrer gets, from your program.
{{reward.referee.label}}What the friend gets, from your program.
{{referrer.first_name}}First name of whoever invited them, if your app set it.
{{program.name}}The name of your active program.

Theme

Eight named colors, each with a light and a dark value, a corner radius, and a font (system, or one you upload). Components refer to colors by name, so changing the theme restyles the whole screen and dark mode always works.

Images, animations and fonts

Upload them in the dashboard and refer to them as asset:<id>. A screen cannot load a file from any other address.

Limits

Draft, publish, roll back

Saving creates a draft and changes nothing for your users. Publishing replaces the live version in one step, and apps pick it up within a minute. Rolling back publishes a copy of an earlier version, so your history stays intact. A placement, for example settings_referral, is the name your app asks for, and you choose which screen it shows.

The editor

You do not have to write any of this by hand. In the dashboard, open your project and choose Screens. Start from a template, select a component in the list on the left, and change it on the right. The preview in the middle is the same renderer your app uses, shown with sample values, on an iPhone or a Pixel, in light or dark.

Changes save to a draft as you make them. If something is not valid, the editor says what and where, and that draft cannot be published until it is fixed. Text fields edit the default language for now. Owners, admins and developers can edit. Viewers can look.

Preview on a device

To see a draft on a phone before you publish it, press Preview on device in the editor and scan the code with a phone that has the ReferralPanda Playground app. The phone shows the newest version of the screen with sample data, and follows your edits within a few seconds. Nothing reaches your users until you publish.

The code works for about an hour and opens that one screen only. Anyone on your team who can see the screen can make one. For now the Playground app is a development build from our repository; it will be in the App Store and Google Play later.