Opscale\NotificationCenter\Notifications\WhatsAppNotificationChannel identifier:
whatsappUnderlying driver:
NotificationChannels\Twilio\TwilioChannel
WhatsAppNotification sends a structured WhatsApp message using a pre-approved Twilio Content Template. The template SID is read from config('notification-center.whatsapp_content_sid'), which is populated from the TWILIO_WHATSAPP_CONTENT_SID environment variable.
Requirements
The
laravel-notification-channels/twilio Composer package must be installed and Twilio credentials (TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, TWILIO_FROM) must be set in your environment.Method signatures
via()
Returns [TwilioChannel::class], routing the notification through the Twilio channel (the same driver used for SMS and voice calls).
toTwilio(object $notifiable): TwilioContentTemplateMessage
Builds and returns a NotificationChannels\Twilio\TwilioContentTemplateMessage with the following payload:
The Twilio Content Template SID read from
config('notification-center.whatsapp_content_sid') (TWILIO_WHATSAPP_CONTENT_SID).An associative array of template variable substitutions indexed by position:
1→$delivery->notification->summary2→$delivery->open_slug
What data it sends
The outbound WhatsApp message is rendered by Twilio using the configured Content Template. The variables injected are:| Variable index | Value |
|---|---|
1 | Notification summary |
2 | Delivery open_slug (for tracking) |
{{1}} and {{2}}) to receive these values.
Usage example
Addwhatsapp to a strategy’s channels array and set the required environment variable:
routeNotificationForTwilio() returning the recipient’s WhatsApp-enabled phone number in E.164 format prefixed with whatsapp::