Get number of a link Shared or Clicked via telegram bot

喜夏-厌秋 提交于 2019-12-06 16:03:03

问题


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.

  1. Number of shares initiated (1) - use inline button with a callback returning URL. When returning URL update the counter.
  2. 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
  3. 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.
  4. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!