CCFish turned Telegram's native share sheet into a self-sustaining viral sales channel — every player becomes a distributor, and every invite carries a purchase-ready lead into the funnel.

The Problem

Mobile game user acquisition is broken. CPI (cost per install) on Meta and Google has climbed past $4–$7 for mid-core casual games, and the funnel leaks at every stage: a click becomes an install maybe 30% of the time, an install becomes a first session maybe 60% of the time, and an organic user costs nearly nothing while a paid user barely breaks even on D7 ROAS. For a Telegram Mini App like CCFish, the math is worse because the install surface is distributed — there is no App Store browse, no search ads within Telegram, and no SDK network that reliably drives Mini App opens.

Worse, most mobile games have zero organic virality. A player enjoys the game alone, closes it, and the cycle ends. Sharing requires conscious effort — screenshot, crop, open another app, paste, send — and offers no incentive. The result is a user acquisition strategy that depends entirely on paid spend, which caps growth at whatever the marketing budget can sustain.

The Solution

CCFish solved this by embedding a referral engine directly into the Telegram Mini App's share flow. Instead of asking players to leave the game and copy a link, the app uses Telegram's native `switch_inline_query` and `share` mechanisms to let a player invite friends in two taps — without ever leaving the chat context.

The core mechanic is **share-to-earn**:

| Action | Reward |

|---|---|

| Invite a friend who opens the Mini App | 50 Pearls (in-game currency) |

| Referred friend completes first fishing session | 100 Pearls + 1 Rare Lure |

| Referred friend makes an in-app purchase | 15% of purchase value as Pearls (uncapped) |

| 5 referred friends active in 7 days | Weekly bonus crate (guaranteed rare item) |

This creates a three-tier viral loop:

1. **Awareness** — The invite lands as a Telegram message with a rich preview (title, image, CTA button). The recipient sees a game invitation, not an ad.

2. **Activation** — Tapping the button opens the Mini App inline. No install required, no friction. The recipient is playing in under 3 seconds.

3. **Conversion** — Once the referred user experiences the core loop (cast line, catch fish, upgrade gear), the game prompts a soft purchase through an exclusive "Welcome Bundle" priced 40% below the standard offer — available only to referred users.

Telegram's infrastructure supercharges every step. The Mini App loads instantly from Telegram's CDN, the share sheet preserves the app's identity (the bot name and avatar accompany every invite), and the deep link carries a unique referral code that survives the entire lifecycle.

Architecture

The referral system has four layers:

**Layer 1 — Invite Generation**

Every CCFish player gets a unique referral code generated on account creation. The code is a compact base62 string — short enough to fit a Telegram button label, collision-resistant without a DB check on every generation:

```javascript

function generateReferralCode(userId) {

const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';

const prefix = 'F';

const randomPart = Array.from({ length: 5 }, () =>

chars[Math.floor(Math.random() * 62)]

).join('');

const checksum = ((userId * 31 + 7) % 62).toString(36);

return `${prefix}${randomPart}${checksum}`.toUpperCase();

}

```

The code is embedded in a Telegram deep link: `https://t.me/CCFishBot?start=REF_CODE`. When a user taps this link, Telegram opens the bot chat and passes `REF_CODE` to the Mini App via `WebAppInitData.startParam`.

**Layer 2 — Attribution**

When the Mini App loads with a `startParam`, the backend does three things synchronously:

1. Look up the referrer by code in Redis (cached TTL: 24h, fallback to PostgreSQL)

2. Create a referral event record: `{ referrer_id, referee_id, timestamp, source: 'telegram_share', landing_page }`

3. Check for fraud — same IP as referrer, account age < 10 seconds, or device fingerprint collision. Suspicious events are flagged and excluded from reward payouts.

```sql

CREATE TABLE referral_events (

id BIGSERIAL PRIMARY KEY,

referrer_id UUID NOT NULL REFERENCES users(id),

referee_id UUID NOT NULL REFERENCES users(id) UNIQUE,

campaign_id TEXT NOT NULL DEFAULT 'default',

source TEXT NOT NULL DEFAULT 'telegram_share',

status TEXT NOT NULL DEFAULT 'pending',

created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),

rewarded_at TIMESTAMPTZ,

CONSTRAINT chk_no_self_ref CHECK (referrer_id != referee_id)

);

```

**Layer 3 — Reward Engine**

Rewards are processed asynchronously through a Celery-style job queue. When a milestone is hit (first open, first session, first purchase), the reward engine checks eligibility rules and credits the referrer's wallet within 2 seconds:

```python

def process_referral_milestone(referee_id: str, milestone: str):

event = db.referral_events.find_one(referee_id=referee_id, status='pending')

if not event:

return

reward_map = {

'first_open': {'pearls': 50},

'first_session': {'pearls': 100, 'item': 'rare_lure'},

'first_purchase': {'pearls': lambda p: int(p * 0.15), 'dynamic': True},

}

reward = reward_map[milestone]

if callable(reward['pearls']):

reward['pearls'] = reward['pearls'](referee_purchase_amount)

credit_wallet(event.referrer_id, reward)

track_analytics('referral_reward', {

'referrer': event.referrer_id,

'milestone': milestone,

'reward': reward

})

```

**Layer 4 — Analytics & Attribution Dashboard**

All referral data flows into a real-time dashboard that shows:

- Referral conversion funnel (invites sent → opened → played → purchased)

- Cohort analysis by referral source (group chat vs. DM vs. channel)

- Referrer leaderboard (gamified internally — top referrers get moderator badges)

Implementation

Telegram Mini App Integration

The referral flow is implemented as a WebApp component that uses Telegram's `switchInlineQuery` method. This lets the app inject a pre-filled message into the chat composer without the user typing anything:

```javascript

function shareInvite() {

const refCode = getUserRefCode();

Telegram.WebApp.switchInlineQuery(

`🎣 Catch fish with me on CCFish!\n\nTap to play and get 50 free Pearls 🐚\n\n${refCode}`,

['users'] // only show user chats, not groups

);

}

```

When the recipient taps the button in the chat, the Mini App receives the referral code via `Telegram.WebApp.initData`:

```javascript

const initData = Telegram.WebApp.initData;

const params = new URLSearchParams(initData);

const startParam = params.get('startParam');

if (startParam) {

registerReferral(startParam);

applyWelcomeBonus();

}

```

Bot Webhook Handler

The Telegram bot handles the `/start REF_CODE` payload and passes it to the Mini App:

```python

@app.message_handler(commands=['start'])

async def handle_start(message: types.Message):

args = message.get_args()

if args and args.startswith('REF'):

Store ref code in short-lived cache for Mini App to pick up

await redis.setex(f"ref:{message.from_user.id}", 300, args)

Always respond with Mini App button

keyboard = types.InlineKeyboardMarkup()

btn = types.InlineKeyboardButton(

text="🎣 Open CCFish",

web_app=types.WebAppInfo(url=MINI_APP_URL)

)

keyboard.add(btn)

await message.reply(

"🎣 Welcome to CCFish!\n\nYour 50 free Pearls are waiting.",

reply_markup=keyboard

)

```

Results

After deploying the referral system, CCFish measured these outcomes over an 8-week period:

| Metric | Before Referral System | After Referral System | Change |

|---|---|---|---|

| Installs/week (Mini App opens) | 1,200 | 4,800 | +300% |

| Cost per referral-sourced user | $0.00 | $0.00 | N/A (organic) |

| Referral share of all new users | 0% | 38% | +38pp |

| D1 retention (referred users) | 32% | 51% | +19pp |

| D7 retention (referred users) | 12% | 27% | +15pp |

| Purchase conversion (referred) | 4.1% | 8.6% | +110% |

| Average revenue per referred user | $0.87 | $2.14 | +146% |

Referred users outperform organic users on every retention and monetization metric. The social proof inherent in receiving an invite from a friend pre-qualifies the lead — referred players arrive with higher intent and lower churn. The 38% share of new users from referrals effectively doubled the growth rate without increasing the ad budget.

Key Takeaways

1. **Zero-cost distribution is real when the platform does the work.** Telegram's share sheet and Mini App infrastructure eliminate install friction. The referral loop costs nothing per invite — just the engineering time to wire it up.

2. **Reward the referrer on the referrer's terms.** CCFish rewards in-game currency (Pearls), not cash. This keeps the incentive inside the game economy, reinforces engagement, and avoids payout complexity.

3. **Incentivize the full funnel, not just the click.** Rewarding first open alone produces low-quality invites. Tying rewards to first session and first purchase shifts referrer behavior toward quality curation.

4. **Fraud prevention must be built in from day one.** A no-friction referral system is also a no-friction abuse target. IP checks, device fingerprinting, and velocity limits prevent reward farming without adding UX friction.

5. **Referred users are your best users.** The data is unambiguous: referred users retain 60% better and convert at 2x the rate of cold acquisition. A referral channel is not just cheaper — it produces higher lifetime value.

CCFish's referral system transformed a simple Telegram Mini App into a viral sales channel. By aligning player incentives with the growth mechanics baked into Telegram's platform, the game turned every player into a distributor and every invite into a high-converting lead. For any mobile game operating inside a messaging platform, this pattern is repeatable and immediately impactful.