Telegram Integration

Integrating Bitte Wallet with Telegram Bot

This guide will walk you through integrating the Bitte Wallet into your Telegram bot. By the end, users will be able to interact with your bot and open the Bitte Wallet Web App directly from a Telegram message.

Prerequisites

Before starting, ensure you have:

  • A Telegram bot set up using the Telegram Bot API.

  • A working environment with Node.js and the node-telegram-bot-api package installed.

Integration Steps

Step 1: Set Up Your Bot

Ensure your Telegram bot is up and running. If you haven't created a bot yet, follow the official guide to create one and obtain your bot's API token.

Step 2: Install Required Package

Ensure you have the node-telegram-bot-api package installed in your Node.js project. If not, install it using npm:

pnpm install node-telegram-bot-api

Step 3: Implement the Command

In your bot's code, implement the /connect command to trigger the Bitte Wallet Web App. The command should look like this:

bot.on('message', (msg: any) => {
    const chatId = msg.chat.id;

    if (msg.text?.startsWith('/connect')) {

        const webAppUrl = `https://wallet.bitte.ai/account/new?password=true`;

        const opts = {
            reply_markup: {
                inline_keyboard: [
                    [{text: "Open Web App", web_app: {url: webAppUrl}}]
                ]
            }
        };
        bot.sendMessage(chatId, messageText, opts);
    } else {
        bot.sendMessage(chatId, 'Send connect to open wallet');
    }
});

All connections work through url schemes so check out #Bitte Wallet Integration via URL Schemes

Last updated

Logo