Skip to content

symfony/novu-notifier

Folders and files

NameName
Last commit message
Last commit date
Sep 25, 2024
Sep 23, 2024
Apr 18, 2024
Jun 16, 2023
Jun 16, 2023
Jun 16, 2023
Oct 20, 2023
Oct 20, 2023
Jun 20, 2024
Jun 16, 2023
Oct 20, 2023
Sep 23, 2024
Jun 16, 2023

Repository files navigation

Novu Notifier

Provides Novu integration for Symfony Notifier.

DSN example

NOVU_DSN=novu://API_KEY@default

Notification example

class NovuNotification extends Notification implements PushNotificationInterface
{
    public function asPushMessage(
        NovuSubscriberRecipient|RecipientInterface $recipient,
        ?string $transport = null,
    ): ?PushMessage {
        return new PushMessage(
            $this->getSubject(),
            $this->getContent(),
            new NovuOptions(
                $recipient->getSubscriberId(),
                $recipient->getFirstName(),
                $recipient->getLastName(),
                $recipient->getEmail(),
                $recipient->getPhone(),
                $recipient->getAvatar(),
                $recipient->getLocale(),
                $recipient->getOverrides(),
                [],
            ),
        );
    }
}
$notification = new NovuNotification;
$notification->subject('test');
$notification->channels(['push']);
$notification->content(
    json_encode(
        [
            'param1' => 'Lorum Ipsum',
        ]
    )
);

$this->notifier->send(
    $notification,
    new NovuSubscriberRecipient(
        "123",
        'Wouter',
        'van der Loop',
        '[email protected]',
        null,
        null,
        null,
        [
            'email' => [
                'from' => '[email protected]',
                'senderName' => 'No-Reply',
            ],
        ],
    ),
);

Resources