PHPackages                             mu7mdmagdy/laravel-telegram-support - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mu7mdmagdy/laravel-telegram-support

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mu7mdmagdy/laravel-telegram-support
===================================

A Laravel package providing a Telegram-powered customer support inbox, a customer chat widget, and a Telegram account-linking component.

1.0.0(1mo ago)48MITVuePHP ^8.2

Since Apr 21Pushed 1mo agoCompare

[ Source](https://github.com/mu7mdmagdy/laravel-telegram-support)[ Packagist](https://packagist.org/packages/mu7mdmagdy/laravel-telegram-support)[ RSS](/packages/mu7mdmagdy-laravel-telegram-support/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

Laravel Telegram Support
========================

[](#laravel-telegram-support)

A Laravel package providing three ready-to-use Blade components for Telegram-based customer support:

ComponentDescription``Admin inbox SPA — list chats from Telegram &amp; web widget``Floating customer chat widget for any page``Telegram account-linking button for forms---

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 11, 12, or 13
- A Telegram Bot Token ([create one](https://t.me/BotFather))

---

Installation
------------

[](#installation)

### 1. Add the package

[](#1-add-the-package)

**From Packagist (when published):**

```
composer require mu7mdmagdy/laravel-telegram-support
```

**From a local path (development):**

Add to your `composer.json`:

```
"repositories": [
    {
        "type": "path",
        "url": "./packages/mu7mdmagdy/laravel-telegram-support"
    }
],
"minimum-stability": "dev",
"prefer-stable": true
```

Then:

```
composer require mu7mdmagdy/laravel-telegram-support:@dev
```

### 2. Publish assets (required)

[](#2-publish-assets-required)

```
php artisan vendor:publish --tag=telegram-assets
```

This copies pre-built JS/CSS to `public/vendor/telegram-support/`.

### 3. Publish the config

[](#3-publish-the-config)

```
php artisan vendor:publish --tag=telegram-config
```

### 4. Run migrations

[](#4-run-migrations)

```
php artisan migrate
```

The package creates these tables:

- `telegram_chats` — conversation sessions (Telegram + web widget)
- `telegram_messages` — all messages (in/out)
- `telegram_settings` — key-value settings store
- `telegram_connect_tokens` — one-time linking tokens

---

Configuration
-------------

[](#configuration)

Edit `config/telegram.php` after publishing:

```
return [
    // Your Telegram bot token from @BotFather
    'bot_token' => env('TELEGRAM_BOT_TOKEN'),

    // Optional: override the auto-discovered bot @username
    'bot_username' => env('TELEGRAM_BOT_USERNAME', ''),

    // Default chat_id to send messages to (optional)
    'default_chat_id' => env('TELEGRAM_DEFAULT_CHAT_ID'),

    // Parse mode for outgoing messages: 'HTML', 'Markdown', or null
    'parse_mode' => env('TELEGRAM_PARSE_MODE', 'HTML'),

    // Telegram API base URL
    'api_url' => env('TELEGRAM_API_URL', 'https://api.telegram.org'),

    // HTTP timeout in seconds
    'timeout' => env('TELEGRAM_TIMEOUT', 10),

    // Hidden input name injected by  after successful connection
    'chat_id_column' => 'telegram_chat_id',

    // Column on your user model used for display name in the widget
    'name_column' => 'name',
];
```

**.env example:**

```
TELEGRAM_BOT_TOKEN=7796489946:AAH8zgmjTDMh7NBdLJ0VePgwVTtaV7HwMrQ
TELEGRAM_BOT_USERNAME=YourSupportBot
TELEGRAM_DEFAULT_CHAT_ID=123456789
```

---

Components
----------

[](#components)

### ``

[](#x-telegram-support)

Admin support inbox. Shows all chats (from Telegram and the web widget) with real-time polling.

```
{{-- Full page --}}

{{-- Embedded panel (600 px tall) --}}

```

**Props:**

PropDefaultDescription`height``100vh`CSS height of the inbox container`min-height``500px`CSS min-height**Typical usage — create a protected admin route:**

```
// routes/web.php
Route::get('/admin/support', fn() => view('admin.support'))->middleware('auth');
```

```
{{-- resources/views/admin/support.blade.php --}}

    Support Inbox

```

---

### ``

[](#x-telegram-widget)

Floating chat bubble at the bottom-right. Visitors can start a support conversation without logging in.

```

```

**Props:**

PropDefaultDescription`title`*(translated)*Widget header title`color``#2196F3`Accent / button colourAdd it to any Blade layout:

```
{{-- resources/views/layouts/app.blade.php --}}
...

    @yield('content')

```

---

### ``

[](#x-telegram-connect)

Embeds a "Connect Telegram" button inside any HTML ``. When the user successfully links their Telegram, the component injects a hidden input into the form — you receive the `telegram_chat_id` in your controller.

```

    @csrf

    {{-- Required: block form until connected --}}

    Register

```

**Props:**

PropDefaultDescription`label`*(translated)*Button label text`required``false`Block form submission until connected**In your controller:**

```
public function register(Request $request)
{
    $request->validate([
        'telegram_chat_id' => 'required|string',
        // ...
    ]);

    $user = User::create([
        'name'             => $request->name,
        'email'            => $request->email,
        'password'         => bcrypt($request->password),
        'telegram_chat_id' => $request->telegram_chat_id,
    ]);
}
```

The hidden input's `name` attribute comes from `config('telegram.chat_id_column')` (default: `telegram_chat_id`). Change it in the config to match your column name.

---

HasTelegramNotifications Trait
------------------------------

[](#hastelegramnotifications-trait)

Add to any Eloquent model to send Telegram messages to that user directly:

```
use MoMagdy\TelegramSupport\Traits\HasTelegramNotifications;

class User extends Authenticatable
{
    use HasTelegramNotifications;
}
```

```
$user->sendTelegramMessage('Your order has shipped! 🚀');

if ($user->hasTelegramLinked()) {
    $user->sendTelegramMessage('Hello from support!');
}
```

The trait reads the chat ID from the column specified in `config('telegram.chat_id_column')`.

---

API Routes
----------

[](#api-routes)

The package registers these routes automatically (no manual `Route::` calls needed):

MethodURIDescriptionPOST`/api/telegram/send`Send a messageGET`/api/telegram/me`Get bot infoGET`/api/telegram/updates`Raw updatesPOST`/api/telegram/sync`Pull &amp; store new messagesGET`/api/telegram/chats`List all chatsGET`/api/telegram/chats/{id}/messages`Messages in a chatPOST`/api/telegram/chats/{id}/send`Reply to a chatPOST`/api/telegram/chats/{id}/read`Mark chat as readPOST`/api/telegram/connect/generate`Generate connect tokenGET`/api/telegram/connect/status`Poll connect statusPOST`/api/widget/session`Start a widget sessionGET`/api/widget/{id}/messages`Get widget messagesPOST`/api/widget/{id}/send`Send a widget message---

Artisan Commands
----------------

[](#artisan-commands)

```
# Test the Telegram integration
php artisan telegram:test

# Override the target chat
php artisan telegram:test --chat_id=123456789
```

---

Multi-language (i18n)
---------------------

[](#multi-language-i18n)

The package ships English and Arabic translations.

**Publish lang files to customise:**

```
php artisan vendor:publish --tag=telegram-lang
```

Files will be published to `lang/vendor/telegram-support/{locale}/telegram.php`.

**HTML lang attribute drives the JS language too:**

```

```

Supported locales: `en`, `ar`. For other locales, publish the lang files and add your translations.

---

Publishing Reference
--------------------

[](#publishing-reference)

TagWhat gets published`telegram-config``config/telegram.php``telegram-migrations``database/migrations/``telegram-lang``lang/vendor/telegram-support/``telegram-assets``public/vendor/telegram-support/`---

License
-------

[](#license)

MIT

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance90

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

49d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/78cb38f7218ab7cabd0e9aada7bc0479943946b00d5da60770247763b9b5b3bd?d=identicon)[mu7mdmagdy](/maintainers/mu7mdmagdy)

---

Top Contributors

[![mu7mdmagdy](https://avatars.githubusercontent.com/u/63126868?v=4)](https://github.com/mu7mdmagdy "mu7mdmagdy (2 commits)")

---

Tags

laravelwidgetbotchattelegramsupport

### Embed Badge

![Health badge](/badges/mu7mdmagdy-laravel-telegram-support/health.svg)

```
[![Health](https://phpackages.com/badges/mu7mdmagdy-laravel-telegram-support/health.svg)](https://phpackages.com/packages/mu7mdmagdy-laravel-telegram-support)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[spatie/laravel-health

Monitor the health of a Laravel application

88011.3M149](/packages/spatie-laravel-health)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9732.3M121](/packages/roots-acorn)[laravel/ai

The official AI SDK for Laravel.

9782.1M153](/packages/laravel-ai)[spatie/laravel-export

Create a static site bundle from a Laravel app

670139.5k6](/packages/spatie-laravel-export)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1232.2k16](/packages/fleetbase-core-api)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
