Managing scheduled tasks in Laravel is powerful, but monitoring their results can be a hassle—especially if you’re tired of sifting through log files or waiting for email notifications. What if you could get instant updates, right where you chat with your team? Enter laravel-schedule-telegram-output: a package that delivers your scheduled job outputs straight to Telegram.
Why Telegram Notifications?
Telegram is fast, reliable, and widely used by development teams. By integrating your Laravel scheduler with Telegram, you can:
- Receive instant feedback on backups, reports, and custom commands.
- Share job results with your team in real time.
- React quickly to errors or failed jobs.
Key Features
- Plug-and-play integration with Laravel’s scheduler.
- Supports MarkdownV2 and HTML for beautifully formatted messages.
- Handles Telegram’s message length limits with smart truncation.
- Debug logging for easy troubleshooting.
- Flexible configuration for multiple bots and chats.
Getting Started
1. Install the package:
composer require klytron/laravel-schedule-telegram-output
2. Configure your bot and chat ID:
Add these to your .env:
TELEGRAM_BOT_TOKEN=your-telegram-bot-token
TELEGRAM_DEFAULT_CHAT_ID=your-chat-id
3. Use in your scheduler:
$schedule->command('your:command')->sendOutputToTelegram();
Or specify a chat:
$schedule->command('your:command')->sendOutputToTelegram('123456789');
4. Advanced Usage:
For more control, use the provided trait:
use Klytron\LaravelScheduleTelegramOutput\TelegramScheduleTrait;
class Kernel extends ConsoleKernel
{
use TelegramScheduleTrait;
protected function schedule(Schedule $schedule)
{
$event = $schedule->command('your:command');
$this->addOutputToTelegram($event, '123456789');
}
}
Real-World Scenarios
- Backup jobs: Get notified when your backups complete (or fail).
- Report generation: Deliver scheduled reports to your team’s Telegram group.
- Error alerts: Instantly know when something goes wrong.
Final Thoughts: With laravel-schedule-telegram-output, you’ll never miss a beat with your scheduled jobs. It’s easy to set up, highly configurable, and brings your Laravel scheduler into the modern, real-time world of chat-based notifications.
Ready to boost your workflow? Check out the package on GitHub!