Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3 Roadmap [Suggestions Wanted] #126

Open
atymic opened this issue Mar 20, 2024 · 3 comments
Open

v3 Roadmap [Suggestions Wanted] #126

atymic opened this issue Mar 20, 2024 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@atymic
Copy link
Collaborator

atymic commented Mar 20, 2024

Is there anything people suggest for v3? Happy to make BC breaks if required, as long as there is a path for migration for existing users.

Strict types will be the main one.
cc @thomasjohnkane

@atymic atymic pinned this issue Mar 20, 2024
@atymic atymic added enhancement New feature or request help wanted Extra attention is needed labels Mar 20, 2024
@madebycaliper
Copy link

Hey this package is great but I'd love to see an implementation of a method like notifyAtInterval() that could be used to create a recurring notification until a certain condition is met. If #104 is ready for merge I could see that being a good start.

For example, consider a Project model with a completed_at and invoiced_at timestamp. When the completed_at value is is modified from null to whatever time and Project is considered "completed," the owner of the project should be notified every week to "Invoice the client!" until invoiced_at is no longer null. Some pseudo code:

// In your controller
$project->completed_at = now();


// Then somewhere inside an observer or whatever
public function wasCompleted(Project $project): ScheduledNotification
{
    $user = $project->owner;

    // Send the reminder immediately
    $user->notify(new InvoiceTheClientReminder($project));

    // Also send reminders every two days
    return $user->notifyAtInterval(
        new InvoiceTheClientReminder($project),
        CarbonInterval::days(2),
        fn(Project $project) => !is_null($project->invoiced_at) // A closure to determine when it should stop sending
    );
}

Under the hood I imagine this could make use of shouldInterrupt but that may also be a very dumb idea. I'm new to the whole world of Notifications.

Thanks for considering this!

@brenjt
Copy link

brenjt commented Apr 10, 2024

A backoff configuration or if someone has an invalid email and the SMTP service fails as an example, it doesn't reattempt it very minute or someway to handle cancelling a notification if an exception is thrown.

Snooze::handleFailedNotifications(function (ScheduledNotification $notification, Throwable $error) {
    // Handle exception
    // 
})

Maybe a max attempts too.

Or just an event when a notification throws an error. event(new NotificationFailed($this));

@npw1982
Copy link

npw1982 commented Aug 20, 2024

A way to defer who the message gets sent to until the time of sending perhaps? Currently, the way we are using it, we are identifying a bunch of users by Role to send the message to. But if those users have been soft deleted at the time the message is sent, they still get the notification (as they have been serialised at the point the notification was scheduled?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants