- How do I install symfony/telegram-notifier in a Laravel application?
- Install via Composer along with spatie/laravel-symfony-notifier. Run composer require symfony/telegram-notifier spatie/laravel-symfony-notifier. Then configure the Notifier service and set your Telegram DSN in .env. This bridge requires Symfony Notifier 6.0+ and PHP 8.1+, so Laravel 10 or newer is recommended.
- How do I configure the Telegram DSN in Laravel?
- Set TELEGRAM_DSN in your .env file using the format telegram://TOKEN@default?channel=CHAT_ID. Add sslmode=disable only when targeting a local API server. Keep the bot token and chat ID in environment variables, never in code. Then retrieve the telegram chatter from Symfony Notifier and send a ChatMessage.
- Can I send Telegram messages with inline keyboards and Markdown formatting?
- Yes. Create a TelegramOptions instance and call parseMode('MarkdownV2'), disableWebPagePreview(true), disableNotification(true), and replyMarkup with an InlineKeyboardMarkup. Attach the options to a ChatMessage before sending. This supports inline keyboards, buttons, media, locations, and other Bot API settings.
- How do I target a local Telegram API server with symfony/telegram-notifier?
- Replace default in the DSN with localhost:5001 or your local server domain. Add sslmode=disable if the server only accepts HTTP. Example: telegram://TOKEN@localhost:5001?channel=CHAT_ID&sslmode=disable. Only use this on trusted internal networks or behind a TLS-termination proxy.
- What Laravel and PHP versions are supported by symfony/telegram-notifier?
- The bridge requires PHP 8.1+ and Symfony Notifier 6.0+. That aligns with Laravel 10 and newer. For older Laravel versions you may need to adjust dependencies or choose a different package. Check spatie/laravel-symfony-notifier compatibility before installing.
- How do I handle Telegram rate limits when sending notifications from Laravel?
- Use Laravel queues to batch and throttle Telegram notifications. Implement exponential backoff and monitor failed jobs in the queue:failed table. Telegram enforces strict rate limits, so avoid sending bursts synchronously. Consider a fallback channel if Telegram delivery fails.
- Is it safe to disable SSL for Telegram notifications?
- Disabling SSL with sslmode=disable is only safe for local API servers on trusted internal networks. For the official Telegram API in production, keep HTTPS enabled. If you use a local server, place a TLS-termination proxy in front of it. Never disable SSL over public networks.
- How do I process Telegram callback queries and interactive button responses in Laravel?
- Create a Laravel webhook route to receive Telegram updates. Use TelegramOptions::answerCallbackQuery() or handle callback data manually. This requires additional setup beyond sending messages. The bridge supports interactive features, but webhook processing is your responsibility.
- What are alternatives to symfony/telegram-notifier for Laravel Telegram notifications?
- Alternatives include laravel-notification-channels/telegram for native Laravel notifications and irazasyed/telegram-bot-sdk for full Bot API control. symfony/telegram-notifier is best when you already use Symfony Notifier or need multi-channel fallback. Compare maintenance, features, and Laravel integration before choosing.
- How is symfony/telegram-notifier maintained and updated?
- It is maintained by the Symfony team as part of the Symfony Notifier bridges. Updates follow Symfony release cycles and Telegram API changes. Monitor Symfony and Telegram changelogs for breaking changes. Use Composer version constraints and test upgrades in staging.