Send bounce notifications to org admins after a week#2089
Merged
stephencdaly merged 6 commits intoMay 14, 2026
Conversation
b0e5539 to
910c3f7
Compare
0feee7e to
8fdd0f5
Compare
910c3f7 to
c68818e
Compare
Base automatically changed from
add-recurring-job-to-notify-group-admins-of-bounces
to
main
May 13, 2026 14:40
Most of the email content is the same when we're sending bounce notifications to org admins and group admins. Re-use the same email template for sending notifications to org admins and provide an additional boolean personalisations so we can include slightly different content for org and group admins.
bd84d51 to
0112dd8
Compare
If we are sending a bounce notification to organisation admins, we want to include a paragraph detailing when we initially contacted the group admins in the email. As most of the other content in the email is the same, pass this in as personalisation rather than using a separate template. We must pass the whole paragraph as personalisation rather than just the dynamic content (group name and contacted date), as Notify does not support optional content with personalisation.
Update the job to accept a parameter for the user role. If the role is "organisation_admin", get the organisation admin users from the group to send the bounce notifications to.
We want to send bounce notifications to org admins 7 days after we've notified the group admins if the bounce has not been resolved. Schdedule a separate SendBounceNotificationsJob job that will look for deliveries that bounced 8 days ago, and send notifications to the organisation admins for the forms they are for.
The new template ID includes additional personalisation for sending to organisation admins. Once the code changes have been deployed, we can remove the old template.
Schedule the ScheduleBounceNotificationsJob to run daily at 2:30am when rails is running in production mode. This job will schedule SendBounceNotificationsJobs to send notifications for any bounces that occurred on the previous day to group admins, and for any bounces that occurred 8 days ago to organisation admins. 2:30am was chosen just to not be the same time as other recurring jobs.
23c4863 to
8e4acf8
Compare
Contributor
|
🎉 A review copy of this PR has been deployed! You can reach it at: https://pr-2089.submit.review.forms.service.gov.uk/ It may take 5 minutes or so for the application to be fully deployed and working. If it still isn't ready For the sign in details and more information, see the review apps wiki page. |
chao-xian
approved these changes
May 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this pull request solve?
Trello card: https://trello.com/c/WmCipXbC
A week after we've contacted group admins about bounced email deliveries, contact the organisation admins.
We contact group admins the day after the bounce, so contact organisation admins 8 days after the bounce.
Re-use the same Notify template and Jobs for sending to organisation admins. Update the ScheduleBounceNotificationsJob to schedule another SendBounceNotificationsJob pass in different parameters for the
bounced_on_dateanduser_role(:group_adminor (:organisation_admin)Testing
I've tested this on dev. See screenshots below.
Note that to test I temporarily changed it to email org admins after 2 days rather than 8 so it would send the email for some bounces I had already triggered, which is reflected in the dates in the screenshotted email.
Email to org admins:
Email to group admins (should be unchanged by this PR):
Things to consider when reviewing