Description
What needs to be done?
Add an optional integration flow so developers can enable Telegram notifications when using the RonasIT/laravel-telescope-extension package. The custom notification class is generated only when the project does not use email — determined by a new interactive question in the initializator.
Scope of work:
1. Add a new interactive question to the initializator flow (after "Will project work with media files?"):
"Will the project send emails?"
If No — proceed with the full Telegram notification setup (steps 2–7).
If Yes — skip the custom notification class generation entirely.
2. Install the package: laravel-notification-channels/telegram
3. Add Telegram bot token configuration in the application:
// config/services.php
'telegram' => [
'token' => env('TELEGRAM_BOT_TOKEN', 'YOUR BOT TOKEN HERE'),
],
4. Add a custom notification class in the application: \App\Notifications\TelescopeReportNotification
- The class must extend
\RonasIT\TelescopeExtension\Notifications\ReportNotification
Example structure:
namespace App\Notifications;
use RonasIT\TelescopeExtension\Notifications\ReportNotification;
use Illuminate\Support\Facades\URL;
class CustomReportNotification extends ReportNotification
{
public function via($notifiable)
{
return ['telegram'];
}
public function toTelegram($notifiable)
{
return TelegramMessage::create()
->to(config('telescope.notifications.report.drivers.telegram.to'))
->view('telegram.telescope-report', [
'entries' => $entries,
'entryEmojiMap' => config('telescope.notifications.report.entry_emoji_map'),
'entryDisplayNameMap' => config('telescope.notifications.report.entry_display_name_map'),
'telescopeBaseUrl' => URL::to(config('telescope.path')),
])
->button('More details in Telescope', URL::to(config('telescope.path')));
}
}
5. Add a Blade template for Telegram message rendering: resources/views/telegram/telescope-report.blade.php
{{ \NotificationChannels\Telegram\TelegramMessage::escapeMarkdown(config('app.name')) }} Telescope collected entries
@foreach ($entries as $type => $count)
@if ($count > 0)
@php
$displayName = $entryDisplayNameMap[$type] ?? ucfirst($type);
$emoji = strip_tags($entryEmojiMap[$type] ?? '');
@endphp
{{ $emoji }} {{ \NotificationChannels\Telegram\TelegramMessage::escapeMarkdown($displayName) }} ({{ $count }})
{{ $telescopeBaseUrl }}/{{ $type }}
@endif
@endforeach
6. Override the default report notification binding in the application container:
// app/Providers/AppServiceProvider.php
$this->app->bind(
\RonasIT\TelescopeExtension\Contracts\ReportNotificationContract::class,
\App\Notifications\CustomReportNotification::class,
);
Expected Outcome
What is the expected result?
- The custom notification class and Telegram setup are generated only when the project does not use email (based on the new "Will the project send email?" initializator question).
- Telegram support is configured on the application side without breaking the default package behavior.
- The bot token is stored in
config/services.php. - Telescope report notifications can be redirected to Telegram through a custom notification class.
- The default notification can be replaced through container binding.
Verification Scenarios
How can this be tested?
- Verify that answering "Yes" to "Will the project send email?" — the notification class is not generated and Telegram setup is skipped entirely.
- Verify that answering "No" to "Will the project send email?" — the full Telegram setup is generated.
- Package
laravel-notification-channels/telegram installed and the project resolves the Telegram channel correctly. - config
services.telegram.token added - Class
\App\Notifications\TelescopeReportNotification created and extends the default package notification. -
ReportNotificationContract binded to \App\Notifications\TelescopeReportNotification Trigger Telescope report sending and confirm the notification is delivered to Telegram.
- Verify the Telegram message uses the Blade template and includes: app name, collected entries, entry links, Telescope details button.
- Ensure that if Telegram setup is not added, the package continues to work with the default notification behavior.
Description
What needs to be done?
Add an optional integration flow so developers can enable Telegram notifications when using the
RonasIT/laravel-telescope-extensionpackage. The custom notification class is generated only when the project does not use email — determined by a new interactive question in the initializator.Scope of work:
1. Add a new interactive question to the initializator flow (after "Will project work with media files?"):
"Will the project send emails?"
If No — proceed with the full Telegram notification setup (steps 2–7).
2. Install the package:
laravel-notification-channels/telegram3. Add Telegram bot token configuration in the application:
4. Add a custom notification class in the application:
\App\Notifications\TelescopeReportNotification\RonasIT\TelescopeExtension\Notifications\ReportNotificationExample structure:
5. Add a Blade template for Telegram message rendering:
resources/views/telegram/telescope-report.blade.php{{ \NotificationChannels\Telegram\TelegramMessage::escapeMarkdown(config('app.name')) }} Telescope collected entries@foreach ($entries as $type => $count)
@if ($count > 0)
@php
$displayName = $entryDisplayNameMap[$type] ?? ucfirst($type);
$emoji = strip_tags($entryEmojiMap[$type] ?? '');
@endphp
{{ $emoji }} {{ \NotificationChannels\Telegram\TelegramMessage::escapeMarkdown($displayName) }} ({{ $count }})
{{ $telescopeBaseUrl }}/{{ $type }}
@endif
@endforeach
6. Override the default report notification binding in the application container:
Expected Outcome
What is the expected result?
config/services.php.Verification Scenarios
How can this be tested?
laravel-notification-channels/telegraminstalled and the project resolves the Telegram channel correctly.services.telegram.tokenadded\App\Notifications\TelescopeReportNotificationcreated and extends the default package notification.ReportNotificationContractbinded to\App\Notifications\TelescopeReportNotificationTrigger Telescope report sending and confirm the notification is delivered to Telegram.