PHPackages                             symfony/telegram-notifier - 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. symfony/telegram-notifier

ActiveSymfony-notifier-bridge

symfony/telegram-notifier
=========================

Symfony Telegram Notifier Bridge

v8.0.4(4mo ago)73882.7k—8.2%4[1 issues](https://github.com/symfony/telegram-notifier/issues)4MITPHPPHP &gt;=8.4

Since Nov 11Pushed 3mo ago4 watchersCompare

[ Source](https://github.com/symfony/telegram-notifier)[ Packagist](https://packagist.org/packages/symfony/telegram-notifier)[ Docs](https://symfony.com)[ Fund](https://symfony.com/sponsor)[ GitHub Sponsors](https://github.com/fabpot)[ RSS](/packages/symfony-telegram-notifier/feed)WikiDiscussions 8.1 Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (145)Used By (4)

Telegram Notifier
=================

[](#telegram-notifier)

Provides [Telegram](https://telegram.org) integration for Symfony Notifier.

DSN example
-----------

[](#dsn-example)

```
TELEGRAM_DSN=telegram://TOKEN@default?channel=CHAT_ID&sslmode=SSLMODE

```

where:

- `TOKEN` is your Telegram token
- `CHAT_ID` is your Telegram chat id
- `SSLMODE` https is used by default. It can be changed by setting value to `disable`, http will be used

Interacting with local API server instead of official Telegram API
------------------------------------------------------------------

[](#interacting-with-local-api-server-instead-of-official-telegram-api)

If such a case is needed, you can replace the `default` keyword in the DSN with the desired domain/IP address of your local API server. You may also want to disable the bridge's default behavior of using `https` protocol as local API servers can only accept `http` traffic.

Example:

```
TELEGRAM_DSN=telegram://TOKEN@localhost:5001?channel=CHAT_ID&sslmode=disable

```

Caution: Disabling the use of the `https` protocol can pose a security risk. You should only do this if your local API server is hosted somehow internally and the traffic will remain within a secure environment.

Otherwise, you may want to implement a TLS-termination proxy in front of your server for handling the encryption and decryption of the traffic, So you can continue using it normally over `https` protocol.

Adding Interactions to a Message
--------------------------------

[](#adding-interactions-to-a-message)

With a Telegram message, you can use the `TelegramOptions` class to add [message options](https://core.telegram.org/bots/api).

```
use Symfony\Component\Notifier\Bridge\Telegram\Reply\Markup\Button\InlineKeyboardButton;
use Symfony\Component\Notifier\Bridge\Telegram\Reply\Markup\InlineKeyboardMarkup;
use Symfony\Component\Notifier\Bridge\Telegram\TelegramOptions;
use Symfony\Component\Notifier\Message\ChatMessage;

$chatMessage = new ChatMessage('');

// Create Telegram options
$telegramOptions = (new TelegramOptions())
    ->chatId('@symfonynotifierdev')
    ->parseMode('MarkdownV2')
    ->disableWebPagePreview(true)
    ->disableNotification(true)
    ->replyMarkup((new InlineKeyboardMarkup())
        ->inlineKeyboard([
            (new InlineKeyboardButton('Visit symfony.com'))
                ->url('https://symfony.com/'),
        ])
    );

// Add the custom options to the chat message and send the message
$chatMessage->options($telegramOptions);

$chatter->send($chatMessage);
```

Adding files to a Message
-------------------------

[](#adding-files-to-a-message)

With a Telegram message, you can use the `TelegramOptions` class to add [message options](https://core.telegram.org/bots/api).

> ⚠️ **WARNING**In one message you can send only one file

[Telegram supports 3 ways](https://core.telegram.org/bots/api#sending-files) for passing files:

- You can send files by passing public http url to option:
    - Photo ```
        $telegramOptions = (new TelegramOptions())
             ->photo('https://localhost/photo.mp4');
        ```
    - Video ```
        $telegramOptions = (new TelegramOptions())
             ->video('https://localhost/video.mp4');
        ```
    - Animation ```
        $telegramOptions = (new TelegramOptions())
             ->animation('https://localhost/animation.gif');
        ```
    - Audio ```
        $telegramOptions = (new TelegramOptions())
             ->audio('https://localhost/audio.ogg');
        ```
    - Document ```
        $telegramOptions = (new TelegramOptions())
             ->document('https://localhost/document.odt');
        ```
    - Sticker ```
        $telegramOptions = (new TelegramOptions())
             ->sticker('https://localhost/sticker.webp', '🤖');
        ```
- You can send files by passing local path to option, in this case file will be sent via multipart/form-data:
    - Photo ```
        $telegramOptions = (new TelegramOptions())
             ->uploadPhoto('files/photo.png');
        ```
    - Video ```
        $telegramOptions = (new TelegramOptions())
             ->uploadVideo('files/video.mp4');
        ```
    - Animation ```
            $telegramOptions = (new TelegramOptions())
                 ->uploadAnimation('files/animation.gif');
        ```
    - Audio ```
        $telegramOptions = (new TelegramOptions())
             ->uploadAudio('files/audio.ogg');
        ```
    - Document ```
        $telegramOptions = (new TelegramOptions())
             ->uploadDocument('files/document.odt');
        ```
    - Sticker ```
        $telegramOptions = (new TelegramOptions())
             ->uploadSticker('files/sticker.webp', '🤖');
        ```
- You can send files by passing file\_id to option:
    - Photo ```
        $telegramOptions = (new TelegramOptions())
             ->photo('ABCDEF');
        ```
    - Video ```
        $telegramOptions = (new TelegramOptions())
             ->video('ABCDEF');
        ```
    - Animation ```
        $telegramOptions = (new TelegramOptions())
             ->animation('ABCDEF');
        ```
    - Audio ```
        $telegramOptions = (new TelegramOptions())
             ->audio('ABCDEF');
        ```
    - Document ```
        $telegramOptions = (new TelegramOptions())
             ->document('ABCDEF');
        ```
    - Sticker - *Can't be sent using file\_id*

Full example:

```
use Symfony\Component\Notifier\Bridge\Telegram\TelegramOptions;
use Symfony\Component\Notifier\Message\ChatMessage;

$chatMessage = new ChatMessage('Photo Caption');

// Create Telegram options
$telegramOptions = (new TelegramOptions())
    ->chatId('@symfonynotifierdev')
    ->parseMode('MarkdownV2')
    ->disableWebPagePreview(true)
    ->hasSpoiler(true)
    ->protectContent(true)
    ->photo('https://symfony.com/favicons/android-chrome-192x192.png');

// Add the custom options to the chat message and send the message
$chatMessage->options($telegramOptions);

$chatter->send($chatMessage);
```

Adding Location to a Message
----------------------------

[](#adding-location-to-a-message)

With a Telegram message, you can use the `TelegramOptions` class to add [message options](https://core.telegram.org/bots/api).

```
use Symfony\Component\Notifier\Bridge\Telegram\TelegramOptions;
use Symfony\Component\Notifier\Message\ChatMessage;

$chatMessage = new ChatMessage('');

// Create Telegram options
$telegramOptions = (new TelegramOptions())
    ->chatId('@symfonynotifierdev')
    ->parseMode('MarkdownV2')
    ->location(48.8566, 2.3522);

// Add the custom options to the chat message and send the message
$chatMessage->options($telegramOptions);

$chatter->send($chatMessage);
```

Adding Venue to a Message
-------------------------

[](#adding-venue-to-a-message)

With a Telegram message, you can use the `TelegramOptions` class to add [message options](https://core.telegram.org/bots/api).

```
use Symfony\Component\Notifier\Bridge\Telegram\TelegramOptions;
use Symfony\Component\Notifier\Message\ChatMessage;

$chatMessage = new ChatMessage('');

// Create Telegram options
$telegramOptions = (new TelegramOptions())
    ->chatId('@symfonynotifierdev')
    ->parseMode('MarkdownV2')
    ->venue(48.8566, 2.3522, 'Center of Paris', 'France, Paris');

// Add the custom options to the chat message and send the message
$chatMessage->options($telegramOptions);

$chatter->send($chatMessage);
```

Adding Contact to a Message
---------------------------

[](#adding-contact-to-a-message)

With a Telegram message, you can use the `TelegramOptions` class to add [message options](https://core.telegram.org/bots/api).

```
use Symfony\Component\Notifier\Bridge\Telegram\TelegramOptions;
use Symfony\Component\Notifier\Message\ChatMessage;

$chatMessage = new ChatMessage('');

$vCard = 'BEGIN:VCARD
VERSION:3.0
N:Doe;John;;;
FN:John Doe
EMAIL;type=INTERNET;type=WORK;type=pref:johnDoe@example.org
TEL;type=WORK;type=pref:+330186657200
END:VCARD';

// Create Telegram options
$telegramOptions = (new TelegramOptions())
    ->chatId('@symfonynotifierdev')
    ->parseMode('MarkdownV2')
    ->contact('+330186657200', 'John', 'Doe', $vCard);

// Add the custom options to the chat message and send the message
$chatMessage->options($telegramOptions);

$chatter->send($chatMessage);
```

Updating Messages
-----------------

[](#updating-messages)

The `TelegramOptions::edit()` method was introduced in Symfony 6.2.

When working with interactive callback buttons, you can use the `TelegramOptions`to reference a previous message to edit.

```
use Symfony\Component\Notifier\Bridge\Telegram\Reply\Markup\Button\InlineKeyboardButton;
use Symfony\Component\Notifier\Bridge\Telegram\Reply\Markup\InlineKeyboardMarkup;
use Symfony\Component\Notifier\Bridge\Telegram\TelegramOptions;
use Symfony\Component\Notifier\Message\ChatMessage;

$chatMessage = new ChatMessage('Are you really sure?');
$telegramOptions = (new TelegramOptions())
    ->chatId($chatId)
    ->edit($messageId) // extracted from callback payload or SentMessage
    ->replyMarkup((new InlineKeyboardMarkup())
        ->inlineKeyboard([
            (new InlineKeyboardButton('Absolutely'))->callbackData('yes'),
        ])
    );
```

Answering Callback Queries
--------------------------

[](#answering-callback-queries)

The `TelegramOptions::answerCallbackQuery()` method was introduced in Symfony 6.3.

When sending message with inline keyboard buttons with callback data, you can use `TelegramOptions` to [answer callback queries](https://core.telegram.org/bots/api#answercallbackquery).

```
use Symfony\Component\Notifier\Bridge\Telegram\TelegramOptions;
use Symfony\Component\Notifier\Message\ChatMessage;

$chatMessage = new ChatMessage('Thank you!');
$telegramOptions = (new TelegramOptions())
    ->chatId($chatId)
    ->answerCallbackQuery(
        callbackQueryId: '12345', // extracted from callback
        showAlert: true,
        cacheTime: 1,
    );
```

Resources
---------

[](#resources)

- [Contributing](https://symfony.com/doc/current/contributing/index.html)
- [Report issues](https://github.com/symfony/symfony/issues) and [send Pull Requests](https://github.com/symfony/symfony/pulls)in the [main Symfony repository](https://github.com/symfony/symfony)

###  Health Score

67

—

FairBetter than 100% of packages

Maintenance77

Regular maintenance activity

Popularity51

Moderate usage in the ecosystem

Community31

Small or concentrated contributor base

Maturity93

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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

Every ~16 days

Recently: every ~6 days

Total

145

Last Release

108d ago

Major Versions

v6.4.13 → v7.1.62024-10-25

v6.4.24 → v7.3.22025-07-10

v7.4.0 → v8.0.02025-09-01

6.4.x-dev → 7.3.x-dev2026-01-05

v7.4.4 → v8.0.42026-01-05

PHP version history (7 changes)v5.0.0-RC1PHP ^7.2.9

v5.0.0PHP ^7.2.5

v5.1.0-RC2PHP &gt;=7.2.5

v6.0.0-BETA1PHP &gt;=8.0.2

v6.1.0-BETA1PHP &gt;=8.1

v7.0.0-BETA1PHP &gt;=8.2

v8.0.0PHP &gt;=8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/47313?v=4)[Fabien Potencier](/maintainers/fabpot)[@fabpot](https://github.com/fabpot)

---

Top Contributors

[![nicolas-grekas](https://avatars.githubusercontent.com/u/243674?v=4)](https://github.com/nicolas-grekas "nicolas-grekas (101 commits)")[![fabpot](https://avatars.githubusercontent.com/u/47313?v=4)](https://github.com/fabpot "fabpot (41 commits)")[![derrabus](https://avatars.githubusercontent.com/u/1506493?v=4)](https://github.com/derrabus "derrabus (26 commits)")[![OskarStark](https://avatars.githubusercontent.com/u/995707?v=4)](https://github.com/OskarStark "OskarStark (23 commits)")[![xabbuh](https://avatars.githubusercontent.com/u/1957048?v=4)](https://github.com/xabbuh "xabbuh (11 commits)")[![keradus](https://avatars.githubusercontent.com/u/2716794?v=4)](https://github.com/keradus "keradus (5 commits)")[![chalasr](https://avatars.githubusercontent.com/u/7502063?v=4)](https://github.com/chalasr "chalasr (4 commits)")[![fancyweb](https://avatars.githubusercontent.com/u/3658119?v=4)](https://github.com/fancyweb "fancyweb (3 commits)")[![alexandre-daubois](https://avatars.githubusercontent.com/u/2144837?v=4)](https://github.com/alexandre-daubois "alexandre-daubois (3 commits)")[![chr-hertel](https://avatars.githubusercontent.com/u/2852185?v=4)](https://github.com/chr-hertel "chr-hertel (2 commits)")[![iamvar](https://avatars.githubusercontent.com/u/7314366?v=4)](https://github.com/iamvar "iamvar (2 commits)")[![GromNaN](https://avatars.githubusercontent.com/u/400034?v=4)](https://github.com/GromNaN "GromNaN (2 commits)")[![MrYamous](https://avatars.githubusercontent.com/u/32437818?v=4)](https://github.com/MrYamous "MrYamous (2 commits)")[![igrizzli](https://avatars.githubusercontent.com/u/960937?v=4)](https://github.com/igrizzli "igrizzli (2 commits)")[![wouterj](https://avatars.githubusercontent.com/u/749025?v=4)](https://github.com/wouterj "wouterj (1 commits)")[![jeremyFreeAgent](https://avatars.githubusercontent.com/u/176363?v=4)](https://github.com/jeremyFreeAgent "jeremyFreeAgent (1 commits)")[![alexsoft](https://avatars.githubusercontent.com/u/1451894?v=4)](https://github.com/alexsoft "alexsoft (1 commits)")[![codedge](https://avatars.githubusercontent.com/u/4409904?v=4)](https://github.com/codedge "codedge (1 commits)")[![glukose](https://avatars.githubusercontent.com/u/1611758?v=4)](https://github.com/glukose "glukose (1 commits)")[![jderusse](https://avatars.githubusercontent.com/u/578547?v=4)](https://github.com/jderusse "jderusse (1 commits)")

---

Tags

componentnotifierphpsymfonysymfony-componenttelegramnotifiertelegram

### Embed Badge

![Health badge](/badges/symfony-telegram-notifier/health.svg)

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

###  Alternatives

[symfony/slack-notifier

Symfony Slack Notifier Bridge

426.1M11](/packages/symfony-slack-notifier)[symfony/fake-sms-notifier

Fake SMS (as email or log during development) Notifier Bridge.

27754.2k1](/packages/symfony-fake-sms-notifier)[symfony/discord-notifier

Symfony Discord Notifier Bridge

37387.7k2](/packages/symfony-discord-notifier)[symfony/twilio-notifier

Symfony Twilio Notifier Bridge

131.2M2](/packages/symfony-twilio-notifier)[chameleon-system/chameleon-base

The Chameleon System core.

1026.5k3](/packages/chameleon-system-chameleon-base)[symfony/firebase-notifier

Symfony Firebase Notifier Bridge

12874.0k1](/packages/symfony-firebase-notifier)

PHPackages © 2026

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