feat: [AB#16890] real-time GovDelivery Communications Cloud subscribe/unsubscribe#12627
Draft
hinzed1127 wants to merge 1 commit intomainfrom
Draft
feat: [AB#16890] real-time GovDelivery Communications Cloud subscribe/unsubscribe#12627hinzed1127 wants to merge 1 commit intomainfrom
hinzed1127 wants to merge 1 commit intomainfrom
Conversation
6ee36b2 to
e91a970
Compare
e91a970 to
1a1d0b4
Compare
Contributor
Author
|
Adding a blocked label here while account permissions troubleshooting continues with the GovDelivery support team |
1a1d0b4 to
ecf67e9
Compare
ecf67e9 to
438b06f
Compare
Wires up the GovDelivery Communications Cloud API v1 to handle newsletter subscribe, unsubscribe, and email-change when users update their profile in the Contact & Notifications tab.
438b06f to
a917230
Compare
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.
Description
This integrates with the GovDelivery Communications Cloud API. When users make updates to their Contact & Notifications settings (via
/profile?tab=contact-notifications), changes to a user's email or newsletter preferences are now propagated to and persisted with GovDelivery.The info organization and UX of the GovDelivery documentation is pretty rough and I leaned heavily on Claude to get things initially going, but everything has been updated, reviewed, and validated by me.
Ticket
This pull request resolves #16890 and #16365.
Approach
GovDeliveryNewsletterClient, that uses the Script Service API and an API key for auth, whereas the Communications Cloud API requires basic auth tied to a specific account. Given that difference, I opted to just create a new client. We should also be able to use this new client exclusively if we choose to deprecateGovDeliveryNewsletterClientin the futuresyncNewsletterSubscriptionis the core business logic. On failure,userRouterreturns a HTTP 502 response and skips the database save that updates user data values foremailand/orreceiveNewsletterpost()→useUserData→profile.tsx→ContactTabPanel, which renders specific error alerts. User edits to email/newsletter fields clear the error.Steps to Test
When
.envvalues that hit GovDelivery's staging environment are omitted, Wiremock values default to mocking successful calls.Testing mocked failure modes
Testing subscribe failure:
subscribeto failure mode:curl -X PUT http://localhost:9000/__admin/scenarios/GovDeliverySubscribe/state -d '{"state": "Failure"}'We were unable to subscribe you to the newsletter. Your changes were not saved. Please try again.curl -X PUT http://localhost:9000/__admin/scenarios/GovDeliverySubscribe/state -d '{"state": "Started"}'Testing unsubscribe failure:
Startedstate).unsubscribeto failure mode:curl -X PUT http://localhost:9000/__admin/scenarios/GovDeliveryUnsubscribe/state -d '{"state": "Failure"}'We were unable to unsubscribe you from the newsletter...Testing email update failure:
updateEmailto failure mode:curl -X PUT http://localhost:9000/__admin/scenarios/GovDeliveryUpdateEmail/state -d '{"state": "Failure"}'We were unable to update your newsletter subscription with your new email....Testing updates to GovDelivery's staging environment
See me for a walkthrough of the staging environment and validating that changes propagate through when the correct
.envvalues are setNotes
api/wiremock/mappings/README.mdCode author checklist
userData(includingprofileData,formationDataetc), then I added a new migration filecmsCollections.ts(see CMS Additions in Engineering Reference/FAQ on the engineering documentation site).envvalues in.env-template, in Bitwarden, and in our workspacesrequest-reviewertag on github to request reviews