Skip to main content

Get Chats

Retrieves a list of chats (dialogs) from the Telegram client.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs

  • Client Id - The unique identifier of the Telegram client to use for this operation.
  • Limit - The maximum number of chats to retrieve (must be greater than 0).
  • Offset - The offset from which to start retrieving chats (must be equal or greater than 0).

Output

  • Chats - An array of chat objects containing chat information.

How It Works

The Get Chats node retrieves a list of chats (dialogs) from the Telegram client. When executed, the node:

  1. Validates the provided inputs (Client Id, Limit, and Offset)
  2. Uses the Telegram client to fetch dialogs with the specified limit and offset
  3. Processes each dialog to extract relevant information:
    • For user chats, extracts the user ID
    • For channel chats, extracts the channel ID and title
  4. Returns the list of chats as output

Requirements

  • A valid Telegram client session with appropriate permissions
  • Valid Limit and Offset values
  • Client Id must match an existing Telegram client session

Error Handling

The node will return specific errors in the following cases:

  • Empty or invalid Client Id
  • Limit value less than or equal to 0
  • Offset value less than 0

Usage Notes

  • The Limit parameter controls how many chats are retrieved in a single call
  • The Offset parameter allows for pagination through the chat list
  • The output contains different information for different types of chats (users vs channels)
  • The Client Id must correspond to an active Telegram client session