Telegram User API Auth icon

Telegram User API Auth

Autenticação na Telegram User API em 2 etapas (tudo dentro do n8n)

Telegram User API Auth

AI-generated

Summary

Authenticate with the Telegram User API in two steps within n8n to obtain a session string for authenticated access.

Inputs

  • step (required) — Select the authentication step: 'requestCode' to send a login code to your Telegram number, or 'confirmCode' to confirm the received code and generate the session string.
  • phoneNumber (required) — Your Telegram phone number with country code, used only in step 1 (requestCode). Must start with '+'.
  • phoneNumberConfirm (required) — The same phone number used in step 1, required only in step 2 (confirmCode).
  • phoneCode (required) — The login code you received via Telegram, required in step 2 (confirmCode).
  • phoneCodeHash (required) — The phone code hash returned from step 1's output; required in step 2 to verify the code.
  • intermediateSession (required) — The intermediate session string returned by step 1; required in step 2 to maintain session continuity.
  • password — Your 2FA password if two-factor authentication is enabled; used only in step 2 if prompted.

Output shape

a single JSON array with one object describing the authentication status and related data

In step 1, returns status 'CODE_SENT' with phoneCodeHash, intermediateSession, and instructions for step 2. In step 2, returns status 'AUTHENTICATED' with the session string and user details. Errors are thrown if parameters are missing or invalid.

Examples

Example 1: Step 1 - Request Code

Set 'step' to 'requestCode' and provide 'phoneNumber'. The node sends a login code to your Telegram app and returns a phoneCodeHash and intermediateSession needed for step 2.

Example 2: Step 2 - Confirm Code

Set 'step' to 'confirmCode' and provide 'phoneNumberConfirm', 'phoneCode', 'phoneCodeHash', and 'intermediateSession' obtained from step 1. If your account has 2FA enabled, also provide 'password'. The node confirms the code, authenticates you, and returns the session string to use in Telegram User API credentials.

Links

Discussion