Telegram MTProto icon

Telegram MTProto

Full-featured Telegram MTProto client (Pyrogram equivalent)

Message → Search Messages

AI-generated

Summary

Search messages in a specified Telegram chat by matching a text query and return up to the specified number of matching messages.

Inputs

  • Chat ID / Username (required) — The identifier of the chat to search in; can be a chat ID, username (including @username), or phone number.
  • Search Query (required) — The text string to search for within messages of the specified chat.
  • Limit — The maximum number of messages to return that match the search query. Defaults to 100.
  • Additional Options — Optional parameters to refine the search, including 'Offset ID' for pagination, 'Min ID' and 'Max ID' to restrict searched message IDs range.

Output shape

a list of message objects matching the search query within the specified chat

The output contains message data matching the search criteria. Pagination is supported through the 'Offset ID' option. If an error occurs during the operation, it will be returned in a structured error format if "Continue On Fail" is enabled.

Examples

Example 1: Search for messages containing the text 'urgent' in a chat by username '@projectchat' limited to 50 results.

Set 'Chat ID / Username' to '@projectchat', 'Search Query' to 'urgent', and 'Limit' to 50.

Discussion