How can a Telegram Bot figure out that user has opened the chat window?

可紊 提交于 2019-12-07 16:06:27

问题


How can a bot send a message to the user, when user just opens the chat.

Example:

  1. User has already added a Telegram bot to his list of contacts and started conversation
  2. Later on, user opens the chat window with that bot
  3. Bot "sees" that user has opened the chat window, but hasn't written anything yet
  4. Bot should say "hello, what can I help you with?" to the user

Is there any event/trigger for a step #3 in Telegram Bot API?


回答1:


No. There is no trigger for each time user opens the chat window but for the first time as below:

When someone opens a chat with bot "FOR THE FIRST TIME", automatically Telegram sends /start command to bot .It is like an ordinary command when user sends a command or write /start and send, so your bot can catch it and say hello or do any commands to that user. As soon as user opens the chat window with your bot, Telegrams send this message automatically to your bot containing info about user and so on.



来源:https://stackoverflow.com/questions/38830013/how-can-a-telegram-bot-figure-out-that-user-has-opened-the-chat-window

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