How to receive messages in group chats using telegram bot api

后端 未结 5 497
一向
一向 2020-12-14 14:44

My telegram bot receives messages sent by user to my bot in private chats but not receives messages sent by users in group chats. Any options/api for getting group chat mess

5条回答
  •  鱼传尺愫
    2020-12-14 15:35

    By default A Bot will receive only messages addressed to it by any user directly via posting by /command@YourBot any message you send. After that it vill be available via getUpdates API call. In browser it will be:

    https://api.telegram.org/botToken/getupdates
    

    Find the related message in output JSON and grab chatId. It will allow you to answer back with:

    https://api.telegram.org/botToken/sendmessage?chat_id=123456788&text=My Answer
    

提交回复
热议问题