Project Overview
The Laravel Schedule Telegram Output package was born from a simple need: "What is my cron job doing right now?" Instead of manually tailing log files or logging into servers to check job statuses, this package pushes the actual output (or errors) directly to your Telegram chat as soon as the job finishes.
The Challenge
Laravel's built-in scheduler is powerful, but visibility into background tasks often requires external monitoring tools or cumbersome log management. On many projects, developers just want to know if a specific daily backup or data sync finished successfully without leaving their primary communication app. Existing solutions were either too complex (requiring whole infrastructure changes) or too limited (no output formatting).
The Solution
I engineered a lightweight "Macro-based" solution. By extending Laravel's Illuminate\Console\Scheduling\Event class, I enabled a simple sendOutputToTelegram() method that can be chained onto any scheduled command. The package handles the heavy lifting of capturing output buffers, handling Telegram API rate limits, and formatting snippets for maximum readability on mobile devices.
Key Innovation & Features
- 🚀 Zero-Friction Integration: Chain
->sendOutputToTelegram()directly in yourKernel.phporroutes/console.php. - ✂️ Smart Snippets: Intelligent truncation (configurable by lines or characters) ensures you only see the most relevant output (e.g., first 10 lines of a success log).
- 🎯 Multi-Chat Routing: Route critical error outputs to a DevOps channel and daily summaries to a management group using per-job chat IDs.
- 🔒 Secure & Lightweight: Zero database dependencies. Fully configured via
.envwith support for MarkdownV2 and HTML parse modes.
Tech Specs & Installation
composer require klytron/laravel-schedule-telegram-output
Check our blogs for more information on how to implement it: Supercharge Your Laravel Scheduler: Send Job Outputs to Telegram Instantly