Positive is a simple Telegram bot demonstrating Web Apps feature introduced in Bot API v.6.0
The bot itself is a modified echo bot implemented using Kotlin wrapper around Telegram bot API Web application source code is under UI folder, it is implemented using React and Typescript.
To run the bot:
-
Create the bot account and obtain bot token at @BotFather
-
Save the token to an environment variable named POSITIVE_BOT_TOKEN, it is used throught the project
-
Build Web App:
cd ui npm i npm run build
After build is done you'll see web static files required for Bot web app at /dist folder.
-
Host generated static somewhere available by HTTPS protocol, for example https://nyavro.github.io/index.html
-
Go to @BotFather and run command /setmenubutton with an URL configured at previous step.
-
Run main Main.kt. This will start echo bot.
-
Open your bot in Telegram and click at Bot's 'menu' button configured at step 5.
-
See the web app, click buttons and get a response from web app to the bot: