i would like to know how telegram referral links work.. how to give special link to users to track their referrals.. code examples would be appreciated.. thanks!
There is not referral for users.
Unique links for users are composed as follow: https://t.me/username or tg://user?id=
You can build something by generating a url that bring to the bot with a start parameter, like this:
https://t.me/bot_username?start=xxxxxx
But I don't know how does this work exactly. Or better, how you get your parameter.
@alexandercerutti thanks for reply..
yes. thats what i was looking for.
https://t.me/bot_username?start=xxxxxx any idea?
This is known as deeplinking, there is more information here on how to use it.
@Stanbear You can grab it with:
bot.onText(/\/start (.+)|\/start/i, function (message, match) {
var invite_code;
if (match[1] != undefined)
invite_code = match[1];
});
thanks @sidelux, how can i grab users joined by the link. any code example? thanks..
You should use message.from.username.
bot.onText(/\/start (.+)|\/start/i, function (message, match) {
var invite_code;
var username;
if (match[1] != undefined){
invite_code = match[1];
username = message.from.username;
}
});
thanks @sidelux. i'll figure out starting from your code!
sorry for the off-topic :{
Most helpful comment
You should use
message.from.username.