App Logo
web.telegram.org

Telegram — Search messages in a conversation

Search inside one Telegram conversation using the conversation's own search box, and return the matching messages: the chat they are in, the date label shown on the result, and the matched text. Returns an empty list when nothing matches, which is a real answer. Note the result rows carry no message id, so results cannot be fed straight to delete or react — use get_conversation for ids. Searching across all chats is a separate Telegram surface and is not covered here.

Input

query required

The text to search for inside the conversation.

peerId required

The conversation to search in, as returned by get_inbox. Required — this script drives the per-conversation search box, not Telegram's global search.

count optional

Maximum results to return from what the search dropdown has rendered.

Default: 30

Output

count required

How many results were returned.

query required

The query that was searched.

peerId required

The peer id that was searched, read back from the address bar.

results required

Matching messages in the order the search dropdown lists them (most recent first). Empty when nothing matched.

chatTitle optional

The conversation title from the header, for a human-readable cross-check against peerId.

Start building not clicking