问题
Hi i want to develop the bot , but first i ask users to share the link of my bot to 5 other users then continue and register in my bot , i develop all sections but i cannot handle the first one, how can i detect that the use send share link to other user ? i user laravel + talageram bot SDK to develop my bot.
i just want to know that user share the link and continue , i search in many docs and site bud i cannot find anythings that useful to me. please help me to handle this problem in my telegram bot . thanks :)
回答1:
Basically, you can't find out if your user has sent the link to others. You can only find out when the other user taps on the link and starts your bot. This can be done by Deep Linking. You should create a unique identifier for each user and add it as a query string to the special link made for the user.
Example:
https://telegram.me/my_bot?invitedFrom=user1
You have to check for invitedFrom
parameter each time a user starts your bot in order to credit the referrer user.
By using above method, you will only be notified when the other user starts your bot.
However there is a trick you can do in order to see if a special message is forwarded to other users. Here are the steps:
- Make a private channel.
- Create a message containing your bot link.
- Forward the message to your bot user.
- Ask your bot user to forward the message to friends.
- Check the view count of the message to know if it's seen by others.
By using this trick you can find out how many times the message containing your bot link is seen.
来源:https://stackoverflow.com/questions/46316848/laravel-check-the-user-share-telegram-bot-link-to-other-users