Portex
  • Getting Started
    • Introduction
    • Workflow
    • ShowCase
    • FAQs
  • CLI
    • Overview
    • New Mini-app
    • Check Mini-app
    • Deploy Mini-app
    • Publish Mini-app
    • Bot Manager
      • Bind Telegram Bot
      • Get Bot Info
      • Bot Menu
        • Set Menu Button
      • Bot Message
        • List Messages
        • Save Message
        • Delete Message
  • SDK
    • Overview
    • Friend Referral
    • Payment
    • Webapp Adapter
Powered by GitBook
On this page
  • API Documentation
  • Interface
  • Example
  • Notes
  1. SDK

Friend Referral

portex.invite is a feature that allows users to invite their friends to join the game.

API Documentation

  • open dialog to invite friends to join the game

invite(options: InviteOptions): Promise<InviteResult>
  • get invite url, don't open dialog

getInviteUrl(options: InviteOptions): Promise<InviteResult>
  • get invite payload, get/set invite payload to server, with a limit of over 64 characters

getInvitePayload(key: string): Promise<InvitePayloadResult>
  • get start param

getStartParam(): string

Interface

interface InviteOptions {
    expire: number; // expiration time, seconds
    text?: string; // invite text in dialog
    payload?: string; // save to server, over 64 characters
    start_param?: string; // invite url with start_param, over 64 characters
}

interface InviteResult {
    invite_url: string; // invite url
    key?: string; // payload key
}

interface InvitePayloadResult {
    payload: string; // payload
}

Example

// Initialize SDK
const portex = new Portex({
  appId: 'your-app-id'
});

// Initialize and verify user
await portex.init();

// Invite friends
const inviteResult = await portex.invite({
  expire: 3600, // Expiration time (seconds)
  text: 'Come play with me!',
  start_param: 'custom-data'
}); 

Notes

  • payload & start_param use one of them, not both

PreviousOverviewNextPayment

Last updated 1 month ago