Telegram Client icon

Telegram Client

Use Telegram Client API

Overview

The node provides integration with the Telegram Client API, enabling various operations to interact with Telegram chats and messages. 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 messages matching certain criteria from Telegram chats, such as monitoring conversations for keywords, extracting information, or automating responses based on message content.

Example use cases:

  • Searching a support channel for messages containing a particular issue keyword.
  • Extracting all messages mentioning a product name in a group chat.
  • Automating workflows that trigger when certain phrases appear in chat history.

Properties

Name Meaning
Chat ID Chat or Channel identifier or username (e.g., @username or -100xxxx) where the search occurs.
Search Query Text string to search for within the messages of the specified chat.
Options Additional optional parameters:
• Silent: Send messages silently without notification (not applicable here).
• 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 the following structure:

{
  "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 ID, date, sender, text content, and any media attachments.

The node does not output binary data for this operation.

Dependencies

  • Requires an active Telegram Client API credential including:
    • A valid session string.
    • API ID and API hash for Telegram.
  • The node uses the Telegram Client SDK internally to connect and perform operations.
  • Network connectivity to Telegram servers is required.
  • No additional environment variables are needed beyond the configured credentials.

Troubleshooting

  • No credentials provided: The node will throw an error if the Telegram API credentials are missing or invalid. Ensure the credentials are correctly set up.
  • Authentication failed: If the session string or API keys are incorrect or expired, authentication will fail. Re-authenticate or update credentials.
  • Operation not supported: Using an unsupported operation value will cause an error.
  • Rate limits or connection issues: Telegram may limit requests or have temporary connectivity problems. Retry after some time or check network access.
  • Empty results: If no messages match the search query, the messages array will be empty. Verify the chat ID and search query correctness.

Links and References

Discussion