Social & teams
Friends, share/invite links, and teams (clans) with roles, invites, and requests.
Friends are a request → accept state machine. Blocking is one-directional and hides a player. Friends power the friends-only leaderboard view.
await tg.social.request(otherPlayerId);
const friends = await tg.social.friends(); Share & invite links
Mint a short code carrying an opaque context blob (a level to try, a referral, a challenge). Resolve it on the recipient's device to read the context — the basis for viral invites and deep links.
const { code } = await tg.social.share({ level: 7 });
const ctx = await tg.social.resolveShare(code); Teams / clans
Teams have an owner, roles (owner/admin/member), and a privacy mode (open, closed, invite-only). Open teams are joined directly; closed teams use a request → approve flow; invite-only teams use invites. Admins can kick, ban, and change roles; the owner can transfer ownership or disband. Teams get their own leaderboards and a shared team storage scope. Every admin action is role-gated server-side — a member calling kick gets team_forbidden.
const { team } = await tg.teams.create('Night Owls', 'OWL', { privacy: 'invite_only' });
await tg.teams.invite(team.id, playerId); // recipient: tg.teams.acceptInvite(inviteId)
const board = await tg.teams.leaderboard('weekly', { agg: 'sum' }); - Realtime rooms
WebSocket rooms with presence, broadcast, in-transit chat moderation, private rooms, and history.
- Turn-based matches
Asynchronous multiplayer (chess, words, card games) over HTTP — no realtime connection needed.
- Leaderboards & competition
Boards, periods, keyed boards, tournaments, and promotion/relegation leagues.