Telegram MTProto Client icon

Telegram MTProto Client

Use Telegram Client API with MTProto protocol

Overview

This node integrates with the Telegram MTProto Client API, allowing users to perform various Telegram operations programmatically. Specifically, the "Get User Info" operation retrieves detailed information about a Telegram user by their user ID or username.

Common scenarios where this node is beneficial include:

  • Fetching profile details of a user for automation workflows.
  • Verifying user identities before sending messages or adding them to groups.
  • Gathering user metadata for analytics or CRM integration.

For example, you can input a Telegram username and get back their full profile data such as name, username, and other public info available via the Telegram API.

Properties

Name Meaning
User ID The Telegram user ID or username (e.g., @username) to retrieve information about. This is required for the "Get User Info" operation.
Options A collection of optional parameters used in some operations but not applicable for "Get User Info".

Note: For the "Get User Info" operation, only the "User ID" property is relevant.

Output

The output JSON object for the "Get User Info" operation contains:

  • success: Boolean indicating if the operation was successful (true).
  • user: An object representing the user's information retrieved from Telegram. This includes all available user entity details as returned by the Telegram MTProto API, such as user ID, first name, last name, username, phone number (if accessible), status, and other profile-related fields.

Example output structure:

{
  "success": true,
  "user": {
    "id": 123456789,
    "firstName": "John",
    "lastName": "Doe",
    "username": "johndoe",
    "phone": "+1234567890",
    "status": { /* user status info */ },
    // ... other Telegram user entity fields
  }
}

No binary data is output by this operation.

Dependencies

  • Requires valid Telegram API credentials including an API ID, API hash, and a session string for authentication.
  • The node uses the Telegram MTProto protocol client library bundled within the node's SDK.
  • Network connectivity to Telegram servers is necessary.
  • Proper configuration of the Telegram API credentials in n8n is mandatory.

Troubleshooting

  • Missing Credentials: If no Telegram API credentials are provided, the node will throw an error "No credentials provided". Ensure that the API ID, API hash, and session are correctly configured.
  • Invalid User ID/Username: Providing an incorrect or non-existent user ID or username may result in errors or empty responses. Verify the input value.
  • Connection Issues: Network problems or Telegram server issues might cause connection failures. The node attempts multiple retries but persistent failures should be checked.
  • Permission Restrictions: Some user information may be restricted due to privacy settings on Telegram, resulting in partial or no data returned.
  • Error Handling: If the node is set to continue on failure, it will return an error message in the output JSON under the error field instead of stopping execution.

Links and References

Discussion