This is a Telegram Web Apps example, I use Cloudflare workers as my web server and bot server. This example can open a web app and return user input to bot, and bot can show user input on Telegram chat.
Demo
Please click article
button on bottom left of the https://t.me/blog_toolman_xyz_bot
Steps
- Create two new Cloudflare workers and paste below code https://gist.github.com/toolmanxyz/bab44386e61f9bc03966ac6d2943615e
- Create a new Telegram Bot in https://t.me/BotFather
- Edit Telegram Bot’s menu button in BotFather :
/mybots
><MyBot>
>Bot Settings
>Menu Button
>Edit Menu button URL
><Your cloudflare workers front end url (ex:https://front-end.example.workers.dev)>
- Open
https://api.telegram.org/bot<Telegram Bot token>/setWebhook?url=<Cloudflare workers back-end url (ex:https://back-end.example.workers.dev)>
in broswer