Setting Up Telegram Auth in 1C-Bitrix

When ordering on the site, customers often abandon the registration form—the entry barrier is high. According to our project data, standard registration with 5-8 fields converts only 30-50% of the time. Telegram authorization reduces drop-offs by 25% and speeds up login to one click. A seamless inte

Our competencies:

Frequently Asked Questions

When ordering on the site, customers often abandon the registration form—the entry barrier is high. According to our project data, standard registration with 5-8 fields converts only 30-50% of the time. Telegram authorization reduces drop-offs by 25% and speeds up login to one click. A seamless integration of the Telegram Login Widget into 1C-Bitrix solves this problem. It relies on the official Telegram mechanism using HMAC-SHA256. We have implemented over 50 such integrations, and each passed load testing. Below are the technical details.

How does the Telegram Login Widget work?

The Telegram Login Widget is an official Telegram mechanism for authorization on third-party sites. Unlike OAuth providers (VKontakte, Google), it uses its own protocol: user data is passed via an HMAC-SHA256 hash with a key derived from the bot token. In 1C-Bitrix, there is no standard module for Telegram authorization, so integration is done manually or through a third-party module.

  1. Place the Telegram widget on the login page (script telegram.org/js/telegram-widget.js).
  2. The user clicks the button, confirms in the Telegram app that they trust the site.
  3. Telegram sends to the callback URL (or JS callback) an object with fields: id, first_name, last_name, username, photo_url, auth_date, hash.
  4. The server verifies the signature: builds a data-check-string from all fields except hash, computes HMAC-SHA256 with key SHA256(bot_token), and compares it with hash.
  5. Checks auth_date — not older than 86400 seconds (protection against replay attacks).
  6. After verification, authorizes or registers the user.
$bot_token = '123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11'; $secret = hash('sha256', $bot_token, true); $data_check_string = ...; // sort and concatenate all fields $hash = hash_hmac('sha256', $data_check_string, $secret); if (hash_equals($hash, $_GET['hash'])) { /* ok */ } 

Why Telegram authorization is better than a standard form?

Criteria Standard Registration Telegram Authorization
Login time 30-60 seconds 2-3 seconds
Number of fields 5-8 0 (one click)
Bot protection CAPTCHA Built-in Telegram check
Completion rate 30-50% 80-95%
Support costs High (password resets) Reduced by 40%

Telegram authorization is 10-30 times faster than a standard form and reduces support load by 40%: users don't lose passwords or create tickets. A 25% reduction in drop-offs is confirmed by the practice of our projects.

Typical technical difficulties during setup

  • "Bot domain invalid" error — occurs if the domain is not set in @BotFather. Solution: use /setdomain to specify the site domain.
  • "Hash invalid" error — incorrect signature or extra fields in the request. Check the field order, use hash_equals for comparison.
  • Widget not displayed — no SSL or script blocked. Install HTTPS, allow script loading from telegram.org.
  • User not found — user field UF_TELEGRAM_ID not created. Create through admin panel or migration.

Case study: online store with 50,000 users

The client complained about a high rate of abandoned carts due to complex registration. We implemented Telegram authorization in 4 hours: created a bot, developed a custom component with callback handler, added a user field. Result: registration drop-offs decreased by 40%, the number of support requests for password recovery dropped by 60%. Stack: 1C-Bitrix (PHP 8.1, infoblocks v2.0), MySQL, Telegram API, component 2.0.

What is included in the work?

Stage Duration Description
System audit from 30 min Check current architecture, entry points, caching
Bot creation from 15 min Via @BotFather, domain binding, token retrieval
Component development from 2 hours Custom component with HMAC-SHA256 check and callback handling
Field creation from 20 min User field UF_TELEGRAM_ID, mapping setup
Integration from 1 hour Binding to existing accounts, roles, business processes
Testing from 1 hour Load testing, mobile devices, security check
Documentation from 30 min Schema, configs, maintenance instructions

Checklist before launch

  • [ ] Domain set in @BotFather (/setdomain)
  • [ ] Site runs on HTTPS with valid certificate
  • [ ] Bot token stored only on server, not on frontend
  • [ ] User field UF_TELEGRAM_ID created (type "Integer")
  • [ ] Signature verified via hash_equals and auth_date time
  • [ ] Widget not blocked by AdBlock or corporate policies

Timeline

Turnkey implementation of Telegram authorization: 4–6 hours. The timeline may be adjusted for complex modifications (CRM connection, business processes). We will estimate your project for free — contact us for a consultation. Order authorization setup, and your users will forget about passwords.

Our experience

For more than 10 years we have been working with 1C-Bitrix and Bitrix24. Every project undergoes code review and load testing. The Telegram Login Widget Documentation confirms the correctness of our approach.