use NotificationChannels\Bird\BirdMessage;
use NotificationChannels\Bird\BirdChannel;
class OrderConfirmation extends Notification
{
public function via($notifiable)
{
return [BirdChannel::class];
}
public function toBird($notifiable)
{
return (new BirdMessage())
->setBody("Your order #{$this->order->id} has been confirmed!")
->setRecipients($notifiable->phone_number);
}
}
use NotificationChannels\Bird\BirdRoute;
class User extends Authenticatable
{
public function routeNotificationForBird($notification)
{
return BirdRoute::make(
recipients: [$this->phone_number],
token: 'custom-access-token', // optional
workspace: 'custom-workspace-id', // optional
channel: 'custom-channel-id' // optional
);
}
}
use NotificationChannels\Bird\BirdMessage;
use NotificationChannels\Bird\BirdRoute;
class OrderConfirmation extends Notification
{
public function toBird($notifiable)
{
// Create a BirdRoute instance
$route = BirdRoute::make(
recipients: ['+31612345678', '+31687654321'],
workspace: 'special-workspace-id',
channel: 'urgent-channel-id'
);
// Create your message
$message = (new BirdMessage())
->setBody("Your order #{$this->order->id} has been confirmed!");
// Apply the route configuration
if ($route->token) {
$message->setAccessToken($route->token);
}
$message->setRecipients($route->recipients);
return $message;
}
}
public function toBird($notifiable)
{
return (new BirdMessage())
->setBody('Your order has been confirmed!')
->setRecipients([
'+31612345678',
'+31687654321'
]);
}