# Deep links for mobile games

> Open the game on a lobby, clan or gift from an invite, give each streamer a link, and credit the player who invited a friend.

Page: https://warplink.app/use-cases/game-app-links

Games spread through friends and creators. A WarpLink invite link opens the game on a lobby, a clan or a gift, a creator link shows which streamer brought a player, and both survive the store install, so a new player starts where the link pointed and not at the title screen.

## How it works

1. **Make an invite link per player.** Create a link whose destination is the lobby, clan or gift screen for that player. Turn on the referral option so the invite can be credited.
2. **Give each creator a link.** Create one link per streamer or channel, with a slug that names them and UTM fields for the channel. A creator code in the description becomes a tap.
3. **Open the game on the invite.** With the SDK in your game, the first launch reads the link and routes to the lobby or clan the invite named. A returning player with the game installed is taken in directly.
4. **Credit the inviter.** After the new player finishes the tutorial, claim the referral with your own player id. Your webhook receives a signed event and grants the gift.
5. **Cover Flutter and React Native builds.** The same calls exist in the iOS, Android, React Native and Flutter SDKs, so the handling code stays small in each engine's wrapper.
6. **Compare creators and invites.** The report shows clicks and installs per link, and the Referrals report shows invites by inviter. Export the click rows as CSV for your own analysis.

## Create a lobby invite and open it on first launch

### REST API (TypeScript)

```typescript
// One invite link per player. The destination is the lobby the friend joins.
const response = await fetch("https://api.warplink.app/v1/links", {
  method: "POST",
  headers: {
      // API key from Keys > API
      Authorization: "Bearer wl_live_YOUR_API_KEY",
      "Content-Type": "application/json",
    },
  body: JSON.stringify({
    app_id: "3f9a1c2e-6b7d-4e1a-9c2f-8a5b1d0e7c44",
    slug: "invite-kai-lobby",
    destination_url: "https://game.example/lobby/k7q2x",
    ios_fallback_url: "https://apps.apple.com/app/id000000000",
    android_fallback_url: "https://play.google.com/store/apps/details?id=com.example.game",
    tags: ["invite", "lobby"],
  }),
});

const link = (await response.json()) as { short_url: string };
```

### iOS (Swift)

```swift
import WarpLink

WarpLinkPasteButton { result in
    guard case .success(let link) = result, let link else { return showGenericWelcome() }
    // The destination you set on the invite link, for example https://example.com/invite/ana
    showWelcome(invitedBy: link.destination)
}
```

### Android (Kotlin)

```kotlin
WarpLink.configure(
    context = this,
    // SDK key from Keys > SDK
    apiKey = "wl_live_yoursdkkeyhere000000000000000000",
    options = WarpLinkOptions(onLink = { result ->
        result.onSuccess { deepLink ->
            // The destination you set on the invite link, for example https://example.com/invite/ana
            showWelcome(invitedBy = deepLink.destination)
        }
    })
)
```

### React Native

```typescript
import { WarpLink } from '@warplink/react-native'

// The person pastes the invitation into a field on your onboarding screen.
const link = await WarpLink.redeemInvitation(pastedText)
if (link) {
  // The destination you set on the invite link, for example https://example.com/invite/ana
  showWelcome({ invitedBy: link.destination })
} else {
  showGenericWelcome()
}
```

### Flutter

```dart
import 'package:warplink_flutter/warplink_flutter.dart';

// The person pastes the invitation into a field on your onboarding screen.
final link = await WarpLink.redeemInvitation(pastedText);
if (link != null) {
  // The destination you set on the invite link, for example https://example.com/invite/ana
  showWelcome(invitedBy: link.destination);
} else {
  showGenericWelcome();
}
```

## What you get

- **Linking.** Invite, clan and gift links that open the game on the right screen, or the store page for someone without it.
- **Attribution.** Installs that follow a tap on a WarpLink link, in any channel, are matched to the invite or the creator that drove them.
- **Analytics.** Clicks and installs per creator and per invite link, and a Referrals report by inviter.

## Questions

### Can a link open a specific lobby or clan?

Yes. The destination is a path in your game, and the SDK returns it on first launch so you can route to the lobby the invite named.

### How do I track which streamer brought players?

Give each streamer a separate link. Installs that follow a tap on that link are matched back to it, and the report shows them next to the clicks.

### How do rewards for invites work?

Claim the referral after sign-up. Your backend receives a signed webhook and grants the reward in your own system.

### What about a player who already has the game?

The tap opens the game on the destination through Universal Links or App Links, with no store step.

### Does the SDK work with my engine?

The SDKs are native for iOS and Android, and there are packages for React Native and Flutter. Call the native SDK from your engine's native layer.

## Related

- [App referral programs](https://warplink.app/use-cases/app-referral-programs)
- [Creator and influencer tracking](https://warplink.app/use-cases/creator-influencer-tracking)
- [Invite-a-friend onboarding](https://warplink.app/use-cases/invite-friends-onboarding)
- [Referrals guide](https://warplink.app/docs/guides/referrals)
- [Deferred deep linking](https://warplink.app/deferred-deep-linking)
