khamidjon-khamidov / flutter_telegram_web_app

MIT License
15 stars 8 forks source link

check if a user is a member of a specific telegram channel #23

Open MadhouseSigma opened 1 week ago

MadhouseSigma commented 1 week ago

I would like to check if a user of my webapp is a member of my channel to unlock certain features. how can i check this?

khamidjon-khamidov commented 1 week ago

@MadhouseSigma You can't directly do it from web app. But what I would do is to send user id to backend and there to check via bot api if the user is member of your channel after which you could send unlocked features.

Also, validation data contains user id. During authentication process, you could add this step in backend.

Ideally, you could do this in Flutter directly, but you would need to hardcode bot keys and your channel id which is a high security risk

MadhouseSigma commented 1 week ago

@MadhouseSigma You can directly do it from web app. But what I would do is to send send user id to backend and there to check via bot if the user is member of your channel after which you could send unlocked features.

Also, validation data contains user id. During authentication process, you could add this step in backend.

Ideally, you could do this in Flutter directly, but you would need to hardcode bot keys and your channel id which is a high security risk

thanks for the assist. I think I'll go the backend rout as well. while I got you, how would you pass parameters from the bot to the webapp? like for example if a user invites another user and i want to track who invited them.

khamidjon-khamidov commented 1 week ago

@MadhouseSigma you can pass args to the web app via link like t.me/bozorbop_bot/bozorchi?startapp=hello . Here hello is an argument. So you could pass id/token of the person who invited, for example

PS: you read find example how to read this value from the library in the example app