Telegram Notifier
Warning: You are browsing the documentation for Symfony 6.0, which is no longer maintained.
Consider upgrading your projects to Symfony 7.1.
Telegram Notifier
The Telegram Notifier package allows to use Telegram via the Symfony Notifier component. Read the main Notifier docs to learn about installing and configuring that component.
Adding Interactions to a Message
With a Telegram message, you can use the TelegramOptions class to add message options:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
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);
This work, including the code samples, is licensed under a
Creative Commons BY-SA 3.0
license.