Overview
Opscale\NotificationCenter\Jobs\SendDelivery is responsible for sending one notification to one profile via one channel. It can be dispatched directly for a specific Delivery record and records the outcome through the TrackEvent service action, which updates the Delivery model’s status accordingly.
ExecuteNotificationStrategy does not dispatch SendDelivery — it calls $profile->notify() directly in its internal sendDelivery() method. SendDelivery is a standalone job you can dispatch independently when you need to re-send a specific delivery record outside the strategy flow.Class signature
Constructor
The
Delivery model representing the specific channel-profile pair for this attempt. The job reads delivery->notification->type to look up the matching queue in config('notification-center.strategies') and places itself on that queue.ExecuteNotificationStrategy — the same strategy queue is used:
transactional strategy queue.
How it works
Resolve the notification class
handle() reads the channel name from the delivery and looks it up in the notification-center.messages map:Resolve the profile
The profile is loaded from the delivery relationship:If the profile cannot be found the job returns silently without throwing.
Send the notification
The notification class is instantiated with the Laravel’s notification system then fires
Delivery model and dispatched via Laravel’s notify() method on the profile:NotificationSent or NotificationFailed events, which are picked up by the TrackEvent listener to update the delivery status.Delivery status transitions
TheDelivery model progresses through the following statuses. Transitions are enforced by DeliveryStatus::canTransitionTo() — invalid transitions are logged as warnings and silently rejected.
| From | Allowed next statuses |
|---|---|
PENDING | SENT, FAILED, EXPIRED |
SENT | RECEIVED, OPENED, EXPIRED |
RECEIVED | OPENED, VERIFIED, EXPIRED |
OPENED | VERIFIED, EXPIRED |
VERIFIED | (terminal) |
FAILED | (terminal) |
EXPIRED | (terminal) |
A delivery that reaches
OPENED or VERIFIED stops the channel escalation cycle in ExecuteNotificationStrategy — no further channels will be attempted for that profile.Retry behavior
Retry settings are not baked intoSendDelivery itself — they are configured per strategy in notification-center.php:
| Config key | Description |
|---|---|
max_attempts | Maximum number of delivery attempts per channel before the delivery is marked FAILED |
retry_interval | Seconds between retries; provide an array for escalating back-off (e.g. [300, 1800]) |
Error handling
When a notification fails, Laravel dispatches aNotificationFailed event. The TrackEvent service action listens to this event and:
- Records a
Failedevent on the delivery with the exception message. - Transitions the delivery status to
FAILED. - For
Alert-type notifications, emits an additionalLog::criticalentry to alert on-call teams.
Registered message channels
The defaultnotification-center.messages map ships with the following channels:
| Key | Notification class |
|---|---|
nova | NovaNotification |
card | CardNotification |
email | EmailNotification |
sms | SmsNotification |
call | CallNotification |
whatsapp | WhatsAppNotification |
webpush | WebPushNotification |
slack | SlackNotification |
teams | TeamsNotification |
config/notification-center.php: