use NotificationChannels\Gronosync\GronosyncChannel;
use NotificationChannels\Gronosync\GronosyncMessage;
class OrderConfirmed extends \Illuminate\Notifications\Notification
{
public function __construct(protected Order $order) {}
public function via(mixed $notifiable): array
{
return [GronosyncChannel::class];
}
public function toGronosync(mixed $notifiable): GronosyncMessage
{
return GronosyncMessage::make()
->text("Ваше замовлення #{$this->order->id} підтверджено!")
->button('Переглянути замовлення', "https://shop.com/orders/{$this->order->id}");
}
}
public function routeNotificationForGronosync(): ?string
{
return $this->gronosync_contact_id; // UUID контакту в GronoSync
}
public function routeNotificationForGronosyncExternalId(): ?string
{
return (string) $this->id; // той самий external_id, що передається в upsertContact()
}
GronosyncMessage::make()->contactExternalId((string) $customer->id)->text('Привіт!');
// новий контакт за ідентифікатором у каналі (телефон, Telegram ID, email…)
GronosyncMessage::make()->to('+380991234567')->channelId($smsChannelId)->text('Ласкаво просимо!');