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

On-Demand Notifications #69

Closed
AntonLugtenburg opened this issue Mar 3, 2020 · 2 comments
Closed

On-Demand Notifications #69

AntonLugtenburg opened this issue Mar 3, 2020 · 2 comments

Comments

@AntonLugtenburg
Copy link

AntonLugtenburg commented Mar 3, 2020

Hello Guys,
I could not find any information about this, but "on Demand" is not supported for Telegram Notifications right ?

https://laravel.com/docs/5.8/notifications#on-demand-notifications

It would be great to post existing Notifications also to groups or channels.
Is there a way to do this with like this ?

Notification::route(TelegramChannel::class, env('TELEGRAM_ADMIN_CHAT_ID')) ->notify(new NOTIFICATION($data));
Notification::route('telegram', env('TELEGRAM_ADMIN_CHAT_ID')) ->notify(new NOTIFICATION($data));

Thank you

@irazasyed
Copy link
Member

Hey @AntonLugtenburg,

On-demand notifications are supported by any notification channel. There is no special requirement. It's simply an anonymous notifiable class.

This should work

Notification::route(\NotificationChannels\Telegram\TelegramChannel::class, 'TELEGRAM_CHAT_ID')
            ->notify(new InvoicePaid($invoice));

Also, You can pass any valid Telegram chat ID that has interacted with your bot (So that can be user, group, or channel).

@AntonLugtenburg
Copy link
Author

Thank you very much for your time and answering. Its working very nicely. Thanks again and have a good time

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