send($setting, $message); } } public function sendTest(NotificationSetting $setting): void { $this->send( $setting, "🐱 *KOL Manager — Test Notification*\n\nYour Telegram channel is configured correctly! 🎉" ); } private function send(NotificationSetting $setting, string $text): void { $config = $setting->config ?? []; $botToken = $config['bot_token'] ?? null; $chatId = $config['chat_id'] ?? null; if (! $botToken || ! $chatId) { throw new \RuntimeException('Telegram bot_token and chat_id are required.'); } $response = Http::timeout(10)->post( "https://api.telegram.org/bot{$botToken}/sendMessage", [ 'chat_id' => $chatId, 'text' => $text, 'parse_mode' => 'Markdown', ] ); if (! $response->successful()) { throw new \RuntimeException('Telegram API error: ' . $response->body()); } } }