Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to retrieve chat id or full request from Exception #193

Closed
AntonLugtenburg opened this issue Apr 16, 2024 · 1 comment
Closed

Unable to retrieve chat id or full request from Exception #193

AntonLugtenburg opened this issue Apr 16, 2024 · 1 comment

Comments

@AntonLugtenburg
Copy link

AntonLugtenburg commented Apr 16, 2024

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

@irazasyed
Copy link
Member

You can listen to the NotificationFailed event which gets dispatched with appropriate data in TelegramChannel. This should be the ideal way if you have multiple notifications.

You can also use the onError(Closure) method to catch the exception in the notification itself from the next version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants