Laravel Package · Vue 3 · Telegram Bot API

Telegram Support
for Laravel

A plug-and-play Laravel package that adds a real-time Telegram-powered support inbox, a customer chat widget, and a Telegram account connect component — all in three Blade tags.

Get Started View on GitHub
$ composer require mu7mdmagdy/laravel-telegram-support

Everything you need, out of the box

Drop one Blade tag into your view and get a fully working, styled, multilingual UI component — no JavaScript configuration needed.

💬
<x-telegram-support />

Support Inbox

A full admin-facing SPA chat interface. See all Telegram conversations in a sidebar, click a chat to open the room, and reply in real time — just like Telegram Web.

Open live demo →
🔔
<x-telegram-widget />

Chat Widget

A floating bubble your site visitors use to reach your Telegram support. Animates in, supports a custom title and brand color, and works on any page in seconds.

Open live demo →
🔗
<x-telegram-connect />

Telegram Connect

Embed inside any registration or profile form. Generates a one-time token, guides the user to message your bot, and injects a hidden input with the resulting chat_id — your controller handles the rest.

Open live demo →

Built for real projects

Designed to be dropped into any existing Laravel app without friction.

⚡

Zero Config Start

Add your bot token to .env and you're live. No extra service registration.

🌍

Multilingual (i18n)

Ships with English & Arabic out of the box. Publish lang files to add any locale.

🎨

Fully Customisable

Color, title, height — every component accepts props. Publish views to go further.

🔐

Configurable Auth Guard

Set your guard name in config (web or api) — the package adapts.

📦

Auto-discovered

Laravel auto-discovery registers the service provider and Blade components automatically.

🧩

Pre-built Vue 3 Assets

No build step for consumers. Assets ship ready-to-publish in dist/.

🗄️

3 Publishable Migrations

Chats, messages, and connect tokens — all with safe up() / down() migrations.

🛠️

Artisan Helper

Run telegram:test to verify your bot token and webhook connectivity instantly.

Create your Telegram Bot with BotFather

Before using this package you need a bot token. BotFather is the official Telegram bot that creates and manages all other bots — the whole process takes under 2 minutes.

BotFather

@BotFather — The one bot to rule them all

BotFather is Telegram's official bot for creating and managing bots. Open it directly at t.me/BotFather and follow the steps below.

1

Open BotFather on Telegram

Search for @BotFather in Telegram or visit t.me/BotFather. Tap Start to begin.

BotFather
👋 I can help you create and manage Telegram bots.

Use these commands:
/newbot — create a new bot
/mybots — manage your bots
BotFather · 10:00
2

Send /newbot

Type and send /newbot to start the bot creation wizard.

You
/newbot
10:01
BotFather
Alright, a new bot. How are we going to call it? Please choose a name for your bot.
BotFather · 10:01
3

Choose a display name

Send any name you like — this is the display name users will see in chats.

You
My Support Bot
10:02
BotFather
Good. Now let's choose a username for your bot. It must end in bot — e.g. mysupportbot or MySupportBot.
BotFather · 10:02
4

Pick a unique username (must end in bot)

Send your desired username. It must be unique across all of Telegram and end with bot.

You
MySupportBot
10:03
BotFather
✅ Done! Congratulations on your new bot.

Use this token to access the HTTP API:
7796489946:AAH8zgmjTDMh7NBdLJ0VeP...

Keep your token secure and store it safely.
BotFather · 10:03
✅
BotFather gives you a bot token — a long string like 1234567890:AABBccDDee.... Copy it — you'll need it next.
5

Add the token to your .env

Open your Laravel project's .env file and set the following variables:

TELEGRAM_BOT_TOKEN=7796489946:AAH8zgmjTDMh7NBdLJ0VeP...
TELEGRAM_BOT_USERNAME=MySupportBot    # without the @
TELEGRAM_GUARD=web                    # or api
💡
Run php artisan telegram:test after setup — it calls the Telegram API and confirms your token is valid.

Up and running in minutes

Four steps from zero to a working support inbox.

1

Require the package

Install via Composer. Laravel auto-discovers the service provider.

$ composer require mu7mdmagdy/laravel-telegram-support
2

Publish assets, config & migrations

# Publish everything at once
$ php artisan vendor:publish --provider="MoMagdy\TelegramSupport\TelegramSupportServiceProvider"

# Or publish individually
$ php artisan vendor:publish --tag=telegram-config
$ php artisan vendor:publish --tag=telegram-assets
$ php artisan vendor:publish --tag=telegram-migrations
$ php artisan migrate
3

Add environment variables

TELEGRAM_BOT_TOKEN=7796489946:AAH8zgmj...
TELEGRAM_BOT_USERNAME=YourBotName
TELEGRAM_GUARD=web        # or api
4

Drop a component into your Blade view

<!-- Admin inbox -->
<x-telegram-support height="100vh" />

<!-- Customer widget -->
<x-telegram-widget title="Support Chat" color="#1e88e5" />

<!-- In a registration form -->
<x-telegram-connect label="Connect Telegram" :required="true" />

Component reference

All props, their types, and defaults at a glance.

<x-telegram-connect /> — Hidden input pattern

<!-- The component injects a hidden input into the parent <form> -->
<!-- Your controller reads it like any other form field:        -->

<form method="POST" action="/register">
        <!-- your other fields ... -->

    <x-telegram-connect
        label="Connect Telegram Account"
        color="#1e88e5"
        :required="true"
    />
    <!-- ↑ injects: <input type="hidden" name="telegram_chat_id" value="..."> -->

    <button type="submit">Register</button>
</form>

<!-- Controller -->
$chatId = $request->input('telegram_chat_id');
$user->update(['telegram_chat_id' => $chatId]);

HasTelegramNotifications trait

// app/Models/User.php
use MoMagdy\TelegramSupport\Traits\HasTelegramNotifications;

class User extends Authenticatable
{
    use HasTelegramNotifications;

    // telegram_chat_id must be in $fillable
    protected $fillable = ['name', 'email', 'telegram_chat_id', ...];
}

// Send a message to this user's Telegram:
$user->sendTelegram('Your order has shipped! 🚀');

config/telegram.php — all options

return [
    'bot_token'      => env('TELEGRAM_BOT_TOKEN'),
    'bot_username'   => env('TELEGRAM_BOT_USERNAME'),
    'guard'          => env('TELEGRAM_GUARD', 'api'),      // auth guard for inbox routes
    'chat_id_column' => 'telegram_chat_id',              // hidden input name
];
🚀

Ready to add Telegram support to your app?

Star the repo, report issues, or contribute a PR — the package is open source and welcoming contributions.

Star on GitHub Report an issue