telegram icon indicating copy to clipboard operation
telegram copied to clipboard

Unable to retrieve chat id or full request from Exception

Open AntonLugtenburg opened this issue 10 months ago • 0 comments

Hello from Germany,

I have a large userbase and they link their profile to my api via a chatbot that identifies their chat_id and stores it.

Some users block the bot instead of unsubscribing, which is fine, but I don't know how to catch the chat_id from the resulting 403 Exception:

Telegram responded with an error 403 - Forbidden: user is deactivated {"exception":"[object] (NotificationChannels\Telegram\Exceptions\CouldNotSendNotification(code: 0): Telegram responded with an error 403 - Forbidden: user is deactivated

The resulting Guzzle Exception does not provide more info...

My logs get flooded and I'm wondering if there is a way to catch this and remove the chat_id from the respective notifiable instance? I have around 100 different Notification Classes and i'd like to avoid putting a log:debug in every each of them to identify the model.

My workaround would be extending the notification channel and catch the client exception, but i'm wondering if this is the way...

Thank you very much

AntonLugtenburg avatar Apr 16 '24 21:04 AntonLugtenburg