Ask A Question

Notifications

You’re not receiving notifications from this thread.

Send Notifications in Rails with Noticed gem v2 Discussion

The video talks about implementing a sort of escalated notification. Like send a slack web hook and then in 5 minutes send an email but not if the recipient already saw the slack web hook.

Is building block for this intended to be something like

config.unless = ->(recipient) {
  self.read?
}

Because there will only be 1 notification no matter how many delivery methods. And the lambda passed to config.if or config.unless is evaluated in the context of the notification so it knows if it has been read?

Reply

Also, what is the best seam to use to test the config.if and config.unless logic? Is it to check for an enqueued job?

Reply

Chris, thanks for making Noticed. I've been using happily using it for a while now and am in the process of upgrading to v2. Any guidance on testing? These specs, for instance, fail:

expect { RsvpLastCallNotifier.with(event: @event).deliver(members) }.to change { ActionMailer::Base.deliveries.count }.by(1)

expect { RsvpLastCallNotifier.with(event: @event).deliver([@member]) }.to have_enqueued_job(ActionMailer::MailDeliveryJob)

Any notion of, say, deliver_now? Appreciate everything you do. Thanks!

Reply

I'm a big fan of Noticed for building multi-channel notifications in Rails apps, so I wrote up this tutorial on building in-app notifications with Noticed and making them real-time with Turbo Streams.

If you haven't had a chance to experiment with Noticed yet, this should be a nice introduction to the gem, and to Turbo Streams and Frames, if you're interested in exploring the Turbo side of the Hotwire stack.

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,584+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.