Telegram Client icon

Telegram Client

Use Telegram Client API

Overview

The "Search Messages" operation in this Telegram Client node allows users to search for messages containing specific text within a particular chat or channel. This is useful for quickly locating relevant conversations, references, or information without manually scrolling through message history.

Common scenarios include:

  • Finding all messages mentioning a keyword or phrase in a group chat.
  • Searching for past announcements or instructions in a channel.
  • Filtering messages by content to automate responses or data extraction.

For example, you could use this node to search for the term "invoice" in a sales channel to retrieve all related messages for processing or review.

Properties

Name Meaning
Chat ID The identifier of the chat or channel where the search will be performed. Can be an ID (e.g., -100xxxx) or username (e.g., @username).
Search Query The text string to look for within the messages of the specified chat.
Options Additional optional parameters:
• Silent: Send messages silently without notification (not applicable here but part of options).
• Caption: Caption for media messages (not applicable here).
• Parse Mode: How to parse message text (none, markdown, html) (not applicable here).
• Limit: Maximum number of messages to return (default 100).

Output

The output JSON contains:

  • success: Boolean indicating if the search was successful.
  • messages: An array of message objects matching the search query. Each message object includes details such as message ID, date, sender info, and message content.

This output enables further processing or filtering of the found messages within n8n workflows.

Dependencies

  • Requires valid Telegram API credentials including an API ID, API hash, and a session string.
  • Uses the Telegram Client SDK internally to connect and perform operations.
  • Needs network access to Telegram servers.
  • No additional environment variables are required beyond the provided credentials.

Troubleshooting

  • No credentials provided: The node will throw an error if the required Telegram API credentials are missing or invalid. Ensure that the API ID, API hash, and session are correctly configured.
  • Connection issues: Network problems or incorrect credentials can cause connection failures. Verify internet connectivity and credential validity.
  • Operation not supported: If an unsupported operation is selected, the node throws an error. Confirm that "Search Messages" is chosen.
  • Empty results: If no messages match the query, the messages array will be empty. Check the search query and chat ID for correctness.
  • Rate limits or API restrictions: Telegram may limit requests; handle errors gracefully and consider adding delays or retries.

Links and References

Discussion