Reputation: 33
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.
Upvotes: 1
Views: 12211
Reputation: 1820
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:
https://api.telegram.org/bot<API_TOKEN>/getChat?chat_id=<CHAT_ID>
Upvotes: 3
Reputation: 484
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
Upvotes: 0