问题
I'm using node-telegram-bot-api module and I want to get number of a link shared by my users to their Friends.
Users have a Share Status Button
Is there a way to display number of a link Shared
or Clicked
by User's Friends in Share Status Button
?
For example
1: John's Share Status Button
: 5 // John Shared to 5 person or 5 person of John's Friends Clicked on that link
2: Maria's Share Status Button
: 20 // Maria Shared to 20 person or 20 person of Maria's Friends Clicked on that link
.
.
Is it possible?
Update:
bot.onText(/\/start/, (msg) => {
const opts = {
reply_markup: JSON.stringify({
keyboard: StartKeyboard,
resize_keyboard: true,
one_time_keyboard: true
})
};
bot.sendMessage(msg.chat.id, `telegram.me/fullmovie_bot?start=${msg.chat.id}`, opts);
console.log (msg)
});
回答1:
There is no directly, but you can get few metrics indirectly.
- Number of shares initiated (1) - use inline button with a callback returning URL. When returning URL update the counter.
- Number of shares initiated + sent (2) - use
switch_inline_query
+ InlineQuery + answerInlineQuery + chosen_inline_result to record attemts to share & completed shares. The inline query could be of form@yourbot invite?id=1234
. This method give you more metrics to your funnel but is less convenient to users - To see ho many times invite was viewed - Use a private channel and create message here, forward to chat with user and ask to forward as an invite. The message will have counter for views.
- To track shares clicked/used use either callback buttons or URL to server code that tracks clicks or deeplinks and check
/start
parameters. It can be of form/start invite?id=123
Above approaches are successfully used in my bot @DebtsTrackerBot
来源:https://stackoverflow.com/questions/46428601/get-number-of-a-link-shared-or-clicked-via-telegram-bot