Telegram guide

Learn how to implement a custom Telegram authentication flow inside your application using the postpress API.

Step 1: Request a QR code

Start by requesting a QR code that the user scans to authenticate their Telegram account. POST to the accounts endpoint or use the matching SDK method.

curl --request POST \
     --url https://api.postpress.ai/v1/accounts \
     --header 'X-API-KEY: ${POSTPRESS_API_KEY}' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '{
  "provider": "TELEGRAM"
}'

Step 2: Display the QR code

The API returns the QR code as a string. Convert it into a visual QR code with a suitable library and display it to the user.

Step 3: Listen for the scan

After displaying the QR code, listen for the user to scan it so you know when the account is authenticated and connected to postpress. There are two ways to do this.

Option A: long request on get account status

Make a GET request to the account endpoint. The request resolves only when the account status changes to connected, indicating a successful authentication. Implement a long polling loop in your backend to handle it.

Option B: account status webhook

Configure an account status webhook to receive a notification when the status changes. Your backend reacts when the account moves to connected, with no polling needed.

Updated May 2026