This page demonstrates the <x-telegram-connect /> component embedded inside a registration-style form.
The component generates a one-time token (e.g. AB12CD), shows the user how to send it to the bot,
and â once the bot receives /connect AB12CD â njects a hidden input with the resulting chat_id â your controller handles the rest.
TELEGRAM_BOT_USERNAME in your .env so the "Open in Telegram" link works correctly.
Current value: (not set)
The connect component is required here â it injects
<input type="hidden" name="telegram_chat_id"> into the form.
The form cannot be submitted until connected. Your controller then reads
$request->input('telegram_chat_id').
The component accepts label and color props for easy customisation:
Drop the component into any Blade view:
<x-telegram-connect label="Connect Telegram" color="#1e88e5" :required="true" />
Config keys (in config/telegram.php):
chat_id_column â Name of the hidden input (default: telegram_chat_id)bot_username â Your bot's username without @ (from TELEGRAM_BOT_USERNAME)In your form controller:
$chatId = $request->input('telegram_chat_id');
// save to users table, session, or anywhere you like
$user->update(['telegram_chat_id' => $chatId]);