skip to Main Content

about telegram bots , how can I get json information from a special chat (not all chats , by chat ID) by url like getupdates (https://api.telegram.org/bot/getupdates) .

because I get little information from getupdates I want to know some info like member IDs and messages IDs etc. in each group and chats.

2

Answers


  1. There is no way to filter updates specifically by chat id (API does not permit that), if not onto your own code, however, you could still filter updates by their type.

    Here’s an example on how to filter callback queries and messages only:

    api.telegram.org/bot{token}/getUpdates?allowed_updates=["callback_query","message"]
    

    Note: as written on BotApi Documentation, even if you pass allowed_updates parameter on getUpdates, only new received updates will be filtered following filters:

    Please note that this parameter doesn’t affect updates created before
    the call to the getUpdates, so unwanted updates may be received for a
    short period of time.

    All possible update types are listed here: core.telegram.org/bots/api#update

    Login or Signup to reply.
  2. Knowing the ID of the chat, you can use these methods:

    All these methods require the chat_id parameter, which can be Integer or String type. You can specify chat or channel username like @channelusername

    Example request:

    https://api.telegram.org/bot<API_TOKEN>/getChat?chat_id=<CHAT_ID>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search