laravel-notification-channels / twilio

Twilio notifications channel for Laravel

Home Page:https://laravel-notification-channels.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

On demand notifications doesn't work

conradwarhol opened this issue · comments

On-demand notifications (as documented here) does not seem to be working with this channel:

\Notification::route(TwilioChannel::class, $phoneNumber)->notify(new MyNotification($data));

Typical notifications with notifiable model work as expected:

$user->notify(new MyNotification($data));

Note: I am using a service_sid and not a from number in config. My laravel version is 5.6

Any ideas?

UPDATE

It works when i use "twilio" instead of class name:

\Notification::route("twilio", $phoneNumber)->notify(new MyNotification($data));

Same issue here using Laravel 5.8

I just checked and it works when i use "twilio" instead of class name:

\Notification::route("twilio", $phoneNumber)->notify(new MyNotification($data));

Maybe this behvaiour should be documented.

I'll try and investigate this when I have a chance.

This is because TwilioChannel::getTo() is doing this:

        if ($notifiable->routeNotificationFor('twilio')) {
            return $notifiable->routeNotificationFor('twilio');
        }