-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Labels
TG IssueIssue that is related rather to Telegram than to this libraryIssue that is related rather to Telegram than to this library
Description
import type { WebApp } from "@twa-dev/types";
function getMiniApp(): WebApp | null {
if (
typeof window !== "undefined" &&
window.Telegram &&
window.Telegram.WebApp
) {
return window?.Telegram?.WebApp;
}
return null;
}
export default function InviteFriends() {
const app = getMiniApp();
const shareUrl = encodeURIComponent(`https://t.me/WhalemapBot/app?startapp=${userId}`);
const telegramUrl = `https://t.me/share/url?url=${shareUrl}`;
return (
<div>
<Button onClick={() => {app.openTelegramLink(telegramUrl))>
Send
</Button>
</div>
)
}
nikitawolfik
Metadata
Metadata
Assignees
Labels
TG IssueIssue that is related rather to Telegram than to this libraryIssue that is related rather to Telegram than to this library