laravel-notification-channels / telegram

✈️ Telegram Notifications Channel for Laravel
https://laravel-notification-channels.com/telegram/
MIT License
990 stars 165 forks source link

How do I get the status of the sent message "ok" and "message_id? #160

Closed sstifler closed 1 year ago

sstifler commented 1 year ago

telegram method sendmessage returns the response {"ok":true,"result":{"message_id":7661 How do I get the status of the sent message "ok" and "message_id?

It would be logical for TelegramMessage::create() to return a telegram response, but it returns the message before sending

        $result = TelegramMessage::create()
            // Optional recipient user id.
            ->to($notifiable)
            ->options($options)
            ->content("test msg")
            ->buttonWithCallback('Test callback button', 'unfollow:unfollow_confirm:');

        dd($result);

        NotificationChannels\Telegram\TelegramMessage {#1291 ▼ // app\Notifications\SendMsg.php:98
          +chunkSize: null
          +token: null
          #payload: array:5 [▶
            "text" => "test msg"
            "parse_mode" => "HTML"
            "chat_id" => "215050601"
            "disable_notification" => true
            "reply_markup" => "{"inline_keyboard":[[{"text":"Test callback button","callback_data":"unfollow:unfollow_confirm:"}]]}"
          ]
          #buttons: array:1 [▶
            0 => array:2 [▶
              "text" => "Test callback button"
              "callback_data" => "unfollow:unfollow_confirm:"
            ]
          ]
        }
irazasyed commented 1 year ago

Use notification events as mentioned in docs Handling Response.