Telegram Client icon

Telegram Client

Use Telegram Client API

Overview

The node provides integration with the Telegram Client API, enabling various messaging and chat management operations within Telegram. Specifically, the "Search Messages" operation allows users to search for messages containing specific text within a given chat or channel.

This node is beneficial in scenarios where you need to programmatically retrieve past messages matching certain criteria, such as searching for keywords in customer support chats, monitoring conversations for specific topics, or extracting information from group discussions.

For example, you could use this node to:

  • Search a Telegram channel for all messages mentioning a product name.
  • Retrieve messages containing error reports from a support group.
  • Filter chat history to find announcements or important updates.

Properties

Name Meaning
Chat ID The identifier of the chat or channel to search in. Can be a numeric ID (e.g., -100xxxx) or username (e.g., @username). Required.
Search Query The text string to search for within the messages of the specified chat. Required.
Options Additional optional parameters:
• Silent: Send message silently without notification (boolean).
• Caption: Caption for media messages (string).
• Parse Mode: How to parse message text; options are None, Markdown, or HTML.
• Limit: Maximum number of messages to return (number, default 100).

Output

The output JSON contains the following structure for the "Search Messages" operation:

{
  "success": true,
  "messages": [
    {
      // Message objects returned by the Telegram client API
    }
  ]
}
  • success: Boolean indicating if the search was successful.
  • messages: An array of message objects matching the search query within the specified chat. Each message object includes details such as message content, sender, date, and other metadata as provided by the Telegram Client API.

The node does not output binary data for this operation.

Dependencies

  • Requires an active Telegram Client API credential, which includes authentication details such as session string, API ID, and API hash.
  • The node uses the Telegram Client SDK internally to connect and perform operations.
  • Network access to Telegram servers is necessary.
  • No additional environment variables or external services are required beyond the Telegram credentials.

Troubleshooting

  • No credentials provided: The node will throw an error if the Telegram Client API credentials are missing or invalid. Ensure that valid credentials are configured.
  • Connection issues: Network problems or incorrect API credentials can cause connection failures. Verify internet connectivity and credential correctness.
  • Operation not supported: If an unsupported operation value is used, the node throws an error indicating the operation is not supported.
  • Limit parameter: Setting an excessively high limit may lead to timeouts or performance issues. Use reasonable limits to avoid these problems.
  • Empty results: If no messages match the search query, the messages array will be empty. Confirm the query text and chat ID are correct.

Links and References

Discussion