Reputation: 30
I'm programming a Telegram bot. I want to search for a specific message in a telegram channel and get its message id. Is it possible? Thx in advance.
Upvotes: 1
Views: 2898
Reputation: 356
As far as I know, you aren't able to search though messages (in a specific chat) by just using Telegram's bot API. You need an MTProto client to do that. You can use pyrogram or telethon to interface with MTProto then use messages.search.
But, there is a catch. If the message you're searching is in a channel, you can webscrape https://t.me/s/CHANNELUSERNAME
with a library like BeautifulSoup.
Upvotes: 5