Add GC Notify one-click unsubscribe callback endpoint#124
Open
smcmurtry wants to merge 3 commits intoServiceCanada:masterfrom
Open
Add GC Notify one-click unsubscribe callback endpoint#124smcmurtry wants to merge 3 commits intoServiceCanada:masterfrom
smcmurtry wants to merge 3 commits intoServiceCanada:masterfrom
Conversation
Adds POST /api/v1/notify/unsubscribe to receive RFC 8058 unsubscribe webhooks from GC Notify. When a recipient clicks the unsubscribe button in Gmail (or another RFC 8058 client), Notify POSTs to this endpoint with the email address and template ID. The handler: - Authenticates via Bearer token (NOTIFY_UNSUBSCRIBE_BEARER_TOKEN env var) - Looks up the CENS topic by templateId - Removes the subscriber using the same logic as /subs/remove/:subscode: findOneAndDelete from subsConfirmed, insert into subsUnsubs, findOneAndDelete from subsExist, upsert into subsRecents - Returns 200 OK with skipped:true if the template or subscriber is not found (avoids Notify retry loops) CENS's own /subs/remove/:subscode body link is unchanged. This is a secondary path triggered only by email-client header-level unsubscribes.
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.
Adds
POST /api/v1/notify/unsubscribeto receive RFC 8058 unsubscribe webhooks from GC Notify. When a recipient clicks the unsubscribe button in Gmail (or another RFC 8058 client), this endpoint receives a POST request the recipient's email address and the template ID.The handler:
templateId/subs/remove/:subscode:findOneAndDeletefromsubsConfirmed, insert intosubsUnsubs,findOneAndDeletefromsubsExist, upsert intosubsRecents200 OKwithskipped:trueif the template or subscriber is not foundCENS's own
/subs/remove/:subscodebody link is unchanged. This is a secondary path triggered only by email-client header-level unsubscribes.You can test by sending a curl request like this, mimicking what Gmail would send (replace
$SUBSCODEwith a valid code):