pythontelegramtelegram-botpy-telegram-bot-api

How to safely transfer data from Telegram Mini App to Django+pyTelegramBotAPI without closing the app


I tried using WebApp.sendData, but it closes the app. I guess I should use POST to send data from browser, but I don't know how do I make the backend know the telegram ID of a user whose Mini App sends this POST request.

I don't have any auth except authentication via Telegram. The app is launched via KeyboardButton.


Solution

  • The way Telegram have suggested:

    i've found these repos which implemented the exactly what telegram says in the documentation. But the backend written in go, so i didn't read it fully, you can check it out if you want:

    An alternative way (not one that Telegram suggested):


    You can always expand on this idea; it's just a different concept that should work, and I think it's secure enough.


    also here some article mb interesting, mb not:)