invite(options: InviteOptions): Promise<InviteResult>
getInviteUrl(options: InviteOptions): Promise<InviteResult>
getInvitePayload(key: string): Promise<InvitePayloadResult>
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
}
// 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'
});