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
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:
Note: as written on BotApi Documentation, even if you pass
allowed_updates
parameter ongetUpdates
, only new received updates will be filtered following filters:All possible update types are listed here: core.telegram.org/bots/api#update
Knowing the ID of the chat, you can use these methods:
getChat – to get up to date info about the chat.
getChatAdministrators – to get a list of admins in a chat.
getChatMembersCount – to get the number of members in a chat.
Int
on successgetChatMember – to get information about a member of a chat.
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: