Skip to main content

Run in Telegram WebApp

Enable dApps to use SDK in the Telegram webapp.

Usage

  • Insert script
<script src="https://telegram.org/js/telegram-web-app.js" />
  • Add configuration: Telegram botId
import { ConfigProvider } from "@portkey/did-ui-react";

ConfigProvider.setGlobalConfig({
socialLogin: {
Telegram: {
botId: TELEGRAM_BOT_ID,
},
},
// ...
});
  • Telegram initialisation: callback of logout (required)
import { TelegramPlatform, did } from "@portkey/did-ui-react";

const handleLogout = () => {
// logout
did.logout();
};

TelegramPlatform.initializeTelegramWebApp({ handleLogout });
  • Configure the bot token in Portkey service
interfaceenvironmentparams
API:api/app/telegramAuth/bot/register
method: POST
TESTNET
https://aa-portkey-test.portkey.finance
MAINNET
https://aa-portkey.portkey.finance
Body
{ "secret": "xxxxxx" }