Closed shahbaz4783 closed 2 months ago
It is simple and straight same as what I did. Just catch the data on frontend, using axios post it to backend and make do with it as your application demands.
The only way to pass data from Telegram SDK is to send the request (fetch/axios) from the frontend. You can't use SDK on the backend, it's frontend-only library.
I'll even advise you save yourself the stress that comes with using sdk and focus on the provided variable by telegram. Try reading up on window.Telegram as that's how Telegram exposed data to mini apps
Im building a tg mini app, i need to get userid of telegram so i can pass it in a function to fetch data. Fetching data works in server component but we cant access user id there as it works in client component only.
is there any way i can access user id in server component??