Skip to content

Contracts & resolvers

Namespace Fomvasss\NotifyTemplates\Contracts.

InterfaceMethodImplemented byBound
NotifyRoleResolverInterfaceresolveUsersForNotify(string $notifyKey, mixed $context = null): arrayyour appby you in the container; the package never calls it
ExternalIdResolverInterfaceresolve(mixed $response): ?stringbuilt-in + your ownconfig('notify-templates.log.external_id_resolvers')
ContentResolverInterfaceresolve(mixed $response): arraybuilt-in + your ownconfig('notify-templates.log.content_resolvers')

Returns notifiables grouped by role key: ['client' => Collection, 'admin' => Collection]. $context is what the caller passes — usually the domain model the notification is about. See Recipients & role subscriptions.

Receives what the channel’s send() returned (NotificationSent::$response) and returns the provider’s message id, or null. The id is stored in notify_logs.external_id and matched by NotifyTemplates::updateDelivery().

Receives the same response and returns ['subject' => ?string, 'body' => ?string]; either key may be missing. Return [] when the response isn’t recognized.

Namespace Fomvasss\NotifyTemplates\Resolvers.

ClassInterfaceReads
MailMessageIdResolverexternal idIlluminate\Mail\SentMessage::getMessageId()
MailContentResolvercontentSubject and HTML body (text body as fallback) of the sent Symfony Email
TelegramMessageIdResolverexternal idresult.message_id of the Bot API response; the first part of a chunked message
TelegramContentResolvercontentresult.text or result.caption of each part, joined by newlines; inline url buttons appended as [text] url

The Telegram resolvers expect the decoded Bot API response as returned by laravel-notification-channels/telegram: {ok, result: {...}}, or a list of those for a chunked message. Anything else gives null / [].

Resolvers are resolved through the container, so they can have constructor dependencies.