PHPackages                             mrjavadseydi/notif-telegram - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. mrjavadseydi/notif-telegram

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

mrjavadseydi/notif-telegram
===========================

Telegram Notifications Channel for Laravel

136PHP

Since Jan 20Pushed 4y ago1 watchersCompare

[ Source](https://github.com/mrjavadseydi/telegram-notif)[ Packagist](https://packagist.org/packages/mrjavadseydi/notif-telegram)[ RSS](/packages/mrjavadseydi-notif-telegram/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Telegram Notifications Channel for Laravel
==========================================

[](#telegram-notifications-channel-for-laravel)

[![Join PHP Chat](https://camo.githubusercontent.com/29f67fb2289efd1ecede6eaa41c82be0e3f93dbf5a8193f1f0fc1b4f33719fa7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f536c61636b2d504850253230436861742d3563366161612e7376673f7374796c653d666c61742d737175617265266c6f676f3d736c61636b266c6162656c436f6c6f723d344131353442)](https://phpchat.co/?ref=laravel-channel-telegram)[![Chat on Telegram](https://camo.githubusercontent.com/c793b6d887d39dac6773fa734b19b63fb1b8a392156528c648c2564000509eba/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4050485043686174436f2d3243413545302e7376673f7374796c653d666c61742d737175617265266c6f676f3d74656c656772616d266c6162656c3d54656c656772616d)](https://t.me/PHPChatCo)[![Laravel Package](https://camo.githubusercontent.com/f3202343dd975ed499e2aacf279c8ad742599e51b866c73d2677afb11ad57e73/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d35253743362d4646324432302e7376673f7374796c653d666c61742d737175617265266c6f676f3d6c61726176656c266c6162656c436f6c6f723d626c61636b266c6f676f436f6c6f723d7768697465)](https://github.com/laravel-notification-channels/telegram)[![Latest Version on Packagist](https://camo.githubusercontent.com/afb682b1bb332a5f8fa641ef9470ba991732060c4d2af1c8d7a7b6f13fe96108/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f74656c656772616d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laravel-notification-channels/telegram)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![SensioLabsInsight](https://camo.githubusercontent.com/23166fdd159a0b9a2ebc0539e7723149c5123ed87a0b25dc08b75031fb46b4c9/68747470733a2f2f696d672e736869656c64732e696f2f73656e73696f6c6162732f692f64323865333165632d353563652d343330362d383861332d3834643564313461643364622e7376673f7374796c653d666c61742d737175617265)](https://insight.sensiolabs.com/projects/d28e31ec-55ce-4306-88a3-84d5d14ad3db)[![Quality Score](https://camo.githubusercontent.com/9c21bb2ff37ed2c840ce948efccdc5ddae4916c0d695c1eb8069e740a846289c/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f74656c656772616d2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/laravel-notification-channels/telegram)[![Total Downloads](https://camo.githubusercontent.com/cbf836d6ed29bc57b269b1a05bacb58bb063229dc58c777b42269ab8f29c1653/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f74656c656772616d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laravel-notification-channels/telegram)

This package makes it easy to send Telegram notification using [Telegram Bot API](https://core.telegram.org/bots) with Laravel.

Contents
--------

[](#contents)

- [Installation](#installation)
    - [Setting up your Telegram bot](#setting-up-your-telegram-bot)
- [Usage](#usage)
    - [Text Notification](#text-notification)
    - [Attach a Photo](#attach-a-photo)
    - [Attach a Document](#attach-a-document)
    - [Attach a Location](#attach-a-location)
    - [Attach a Video](#attach-a-video)
    - [Attach a Gif File](#attach-a-gif-file)
    - [Available Message methods](#available-message-methods)
    - [Available Location methods](#available-location-methods)
    - [Available File methods](#available-file-methods)
- [Alternatives](#alternatives)
- [Changelog](#changelog)
- [Testing](#testing)
- [Security](#security)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)

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

[](#installation)

You can install the package via composer:

```
composer require laravel-notification-channels/telegram
```

Setting up your Telegram Bot
----------------------------

[](#setting-up-your-telegram-bot)

Talk to [@BotFather](https://core.telegram.org/bots#6-botfather) and generate a Bot API Token.

Then, configure your Telegram Bot API Token:

```
// config/services.php
...
'telegram-bot-api' => [
    'token' => env('TELEGRAM_BOT_TOKEN', 'YOUR BOT TOKEN HERE')
],
...
```

Usage
-----

[](#usage)

You can now use the channel in your `via()` method inside the Notification class.

### Text Notification

[](#text-notification)

```
use NotificationChannels\Telegram\TelegramChannel;
use NotificationChannels\Telegram\TelegramMessage;
use Illuminate\Notifications\Notification;

class InvoicePaid extends Notification
{
    public function via($notifiable)
    {
        return [TelegramChannel::class];
    }

    public function toTelegram($notifiable)
    {
        $url = url('/invoice/' . $this->invoice->id);

        return TelegramMessage::create()
            // Optional recipient user id.
            ->to($notifiable->telegram_user_id)
            // Markdown supported.
            ->content("Hello there!\nYour invoice has been *PAID*")
            // (Optional) Inline Buttons
            ->button('View Invoice', $url)
            ->button('Download Invoice', $url);
    }
}
```

Here's a screenshot preview of the above notification on Telegram Messenger:

[![Laravel Telegram Notification Example](https://user-images.githubusercontent.com/1915268/66616627-39be6180-ebef-11e9-92cc-f2da81da047a.jpg)](https://user-images.githubusercontent.com/1915268/66616627-39be6180-ebef-11e9-92cc-f2da81da047a.jpg)

### Attach a Photo

[](#attach-a-photo)

```
public function toTelegram($notifiable)
{
    $url = url('/file/' . $this->file->id);

    return TelegramFile::create()
        ->to($notifiable->telegram_user_id)
        ->content('Awesome *bold* text and [inline URL](http://www.example.com/)')
        ->file('/storage/archive/6029014.jpg', 'photo'); // local photo

        // OR using a helper method with or without a remote file.
        // ->photo('https://file-examples.com/wp-content/uploads/2017/10/file_example_JPG_1MB.jpg');
}
```

Preview:

[![Laravel Telegram Photo Notification Example](https://user-images.githubusercontent.com/1915268/66616792-daad1c80-ebef-11e9-9bdf-c0bc484cf037.jpg)](https://user-images.githubusercontent.com/1915268/66616792-daad1c80-ebef-11e9-9bdf-c0bc484cf037.jpg)

### Attach a Document

[](#attach-a-document)

```
public function toTelegram($notifiable)
{
    $url = url('/file/' . $this->file->id);

    return TelegramFile::create()
        ->to($notifiable->telegram_user_id)
        ->content('Did you know we can set a custom filename too?')
        ->document('https://file-examples.com/wp-content/uploads/2017/10/file-sample_150kB.pdf', 'sample.pdf');
}
```

Preview:

[![Laravel Telegram Document Notification Example](https://user-images.githubusercontent.com/1915268/66616850-10520580-ebf0-11e9-9122-4f4d263f3b53.jpg)](https://user-images.githubusercontent.com/1915268/66616850-10520580-ebf0-11e9-9122-4f4d263f3b53.jpg)

### Attach a Location

[](#attach-a-location)

```
public function toTelegram($notifiable)
{
    return TelegramLocation::create()
        ->to($notifiable->telegram_user_id)
        ->latitude('40.6892494')
        ->longitude('-74.0466891');
}
```

Preview:

[![Laravel Telegram Location Notification Example](https://user-images.githubusercontent.com/1915268/66616918-54450a80-ebf0-11e9-86ea-d5264fe05ba9.jpg)](https://user-images.githubusercontent.com/1915268/66616918-54450a80-ebf0-11e9-86ea-d5264fe05ba9.jpg)

### Attach a Video

[](#attach-a-video)

```
public function toTelegram($notifiable)
{
    return TelegramFile::create()
        ->to($notifiable->telegram_user_id)
        ->content('Sample *video* notification!')
        ->video('https://file-examples.com/wp-content/uploads/2017/04/file_example_MP4_480_1_5MG.mp4');
}
```

Preview:

[![Laravel Telegram Video Notification Example](https://user-images.githubusercontent.com/1915268/66617038-ed742100-ebf0-11e9-865a-bf0245d2cbbb.jpg)](https://user-images.githubusercontent.com/1915268/66617038-ed742100-ebf0-11e9-865a-bf0245d2cbbb.jpg)

### Attach a Gif File

[](#attach-a-gif-file)

```
public function toTelegram($notifiable)
{
    return TelegramFile::create()
        ->content('Woot! We can send animated gif notifications too!')
        ->animation('https://sample-videos.com/gif/2.gif');

        // Or local file
        // ->animation('/path/to/some/animated.gif');
}
```

Preview:

[![Laravel Telegram Gif Notification Example](https://user-images.githubusercontent.com/1915268/66617071-109ed080-ebf1-11e9-989b-b237f2b9502d.jpg)](https://user-images.githubusercontent.com/1915268/66617071-109ed080-ebf1-11e9-989b-b237f2b9502d.jpg)

### Routing a message

[](#routing-a-message)

You can either send the notification by providing with the chat id of the recipient to the `to($chatId)` method like shown in the above example or add a `routeNotificationForTelegram()` method in your notifiable model:

```
...
/**
 * Route notifications for the Telegram channel.
 *
 * @return int
 */
public function routeNotificationForTelegram()
{
    return $this->telegram_user_id;
}
...
```

### Available Message methods

[](#available-message-methods)

- `to($chatId)`: (integer) Recipient's chat id.
- `content('')`: (string) Notification message, supports markdown. For more information on supported markdown styles, check out these [docs](https://telegram-bot-sdk.readme.io/reference#section-formatting-options).
- `button($text, $url)`: (string) Adds an inline "Call to Action" button. You can add as many as you want and they'll be placed 2 in a row.
- `disableNotification()`: Send the message silently. Users will receive a notification with no sound.
- `options([])`: (array) Allows you to add additional or override `sendMessage` payload (A Telegram Bot API method used to send message internally). For more information on supported parameters, check out these [docs](https://telegram-bot-sdk.readme.io/docs/sendmessage).

### Available Location methods

[](#available-location-methods)

- `to($chatId)`: (integer) Recipient's chat id.
- `latitude($latitude)`: (float|string) Latitude of the location.
- `longitude($longitude)`: (float|string) Longitude of the location.
- `button($text, $url)`: (string) Adds an inline "Call to Action" button. You can add as many as you want and they'll be placed 2 in a row.
- `disableNotification()`: Send the message silently. Users will receive a notification with no sound.
- `options([])`: (array) Allows you to add additional or override the payload.

### Available File methods

[](#available-file-methods)

- `to($chatId)`: (integer) Recipient's chat id.
- `content('')`: (string) File caption, supports markdown. For more information on supported markdown styles, check out these [docs](https://telegram-bot-sdk.readme.io/reference#section-formatting-options).
- `file($file, $type, $filename = null)`: Local file path or remote URL, `$type` of the file (Ex:`photo`, `audio`, `document`, `video`, `animation`, `voice`, `video_note_`) and optionally filename with extension. Ex: `sample.pdf`. You can use helper methods instead of using this to make it easier to work with file attachment.
- `photo($file)`: Helper method to attach a photo.
- `audio($file)`: Helper method to attach an audio file (MP3 file).
- `document($file, $filename = null)`: Helper method to attach a document or any file as document.
- `video($file)`: Helper method to attach a video file.
- `animation($file)`: Helper method to attach an animated gif file.
- `voice($file)`: Helper method to attach a voice note (`.ogg` file with OPUS encoded).
- `videoNote($file)`: Helper method to attach a video note file (Upto 1 min long, rounded square video).
- `button($text, $url)`: (string) Adds an inline "Call to Action" button. You can add as many as you want and they'll be placed 2 in a row.
- `disableNotification()`: Send the message silently. Users will receive a notification with no sound.
- `options([])`: (array) Allows you to add additional or override the payload.

Alternatives
------------

[](#alternatives)

For advance usage, please consider using [telegram-bot-sdk](https://github.com/irazasyed/telegram-bot-sdk) instead.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Irfaq Syed](https://github.com/irazasyed)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity27

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/59200320?v=4)[mohammadjavad seydi](/maintainers/MrjavadSeydi)[@mrjavadseydi](https://github.com/mrjavadseydi)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/mrjavadseydi-notif-telegram/health.svg)

```
[![Health](https://phpackages.com/badges/mrjavadseydi-notif-telegram/health.svg)](https://phpackages.com/packages/mrjavadseydi-notif-telegram)
```

###  Alternatives

[tijsverkoyen/css-to-inline-styles

CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.

5.8k505.3M227](/packages/tijsverkoyen-css-to-inline-styles)[minishlink/web-push

Web Push library for PHP

1.9k12.0M53](/packages/minishlink-web-push)[laravel-notification-channels/twilio

Provides Twilio notification channel for Laravel

2587.7M12](/packages/laravel-notification-channels-twilio)[spatie/url-signer

Generate a url with an expiration date and signature to prevent unauthorized access

4422.3M16](/packages/spatie-url-signer)[mattketmo/email-checker

Throwaway email detection library

2742.0M5](/packages/mattketmo-email-checker)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)

PHPackages © 2026

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