Invite Module
This page introduces how to use the Playol SDK's Invite Module to implement efficient sharing, user acquisition, and multiplayer room matching. Powered by the platform's short-link system and automatic parameter injection, the full invite lifecycle — from link generation to sharing, redirecting, and parameter delivery — is handled seamlessly, with no need to build your own logic.
📌 1. Use Cases
- Players invite friends to join the game (supports single or multiplayer sessions);
- Run promotions or referral events (with invite codes, promo codes, etc.);
- Share room IDs for one-click join or group matchmaking;
- Short links enable tracking of origin and user binding;
- The SDK auto-injects invite parameters on page load — no need to manually parse the URL.
🧩 2. Methods & Usage
🔗 Create Invite Link
createInviteLink(params)
Asynchronously generates a game-specific invite link with optional context parameters.
const link = await window.playolSDK.invite.createInviteLink({
roomId: 'abc123',
source: 'friend'
})
console.log('Generated invite link:', link)📌 Parameter Rules:
paramsshould be an object of{ [key]: string | number }- All keys must be strings; values can be strings or numbers
- Invalid formats will be rejected to prevent broken links
📤 Show Invite Button
showInviteButton(params)
Opens a built-in invite popup that generates and displays the invite link.
const link = await window.playolSDK.invite.showInviteButton({
event: 'spring2025',
roomId: 'room-789'
})
console.log('Returned invite link:', link)📌 Notes:
- Same parameter structure as
createInviteLink() - Mobile-friendly UI is built-in — no need for custom design
📥 Read Invite Parameters
inviteParams
When a user opens an invite link, the SDK automatically injects parameters for direct access.
const params = window.playolSDK.invite.inviteParams
console.log('Invite parameters:', params)📌 Notes:
inviteParamsincludes only the fields passed by the game during invite creation;- Use original key names — no extra parsing required.
⚙️ 3. Parameter Validation
- Parameters must be a flat object with string keys and string/number values;
- Arrays, nested objects, null, and boolean types are not supported;
- The SDK performs strict validation — invalid input will be rejected automatically.
🛠️ 4. Recommended Use Patterns
| Scenario | Suggested Method |
|---|---|
| Friend invite to join room | createInviteLink(params) + custom share button |
| Event or seasonal promotions | showInviteButton(params) |
| Detect invite-based entry | Check if inviteParams contains expected fields |
| Access room/event ID | inviteParams.roomId / inviteParams.event |
📦 5. FAQ
Q: What parameters are included in the invite link?
A: Only those passed by the game during link creation — platform-internal fields are never exposed.
Q: Can I use custom parameters?
A: Yes. You can pass any flat key-value object (e.g., for events, rewards, multiplayer context).
Q: How does the invited player get the data?
A: Simply read window.playolSDK.invite.inviteParams after the game loads.
Q: Can users generate multiple invites?
A: Yes. Every call returns a unique short link with its own data, ideal for multi-channel promotion.
Q: What if parameters are invalid?
A: The SDK includes internal validation — improper formats will be rejected gracefully.