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

[CCAP-493] Create sendGrid family confirmation email and background job #970

Open
wants to merge 33 commits into
base: main
Choose a base branch
from

Conversation

spokenbird
Copy link
Contributor

🔗 Jira ticket

CCAP-493

✍️ Description

Creates a SendGridEmailService and background job which is enqueued via an action. The action queue's a background job to send an email via the sendgrid API.

@enyia21 enyia21 temporarily deployed to il-gcc-ccap-493-family--n4tpgk December 23, 2024 21:48 Inactive
@spokenbird spokenbird temporarily deployed to il-gcc-ccap-493-family--n4tpgk December 23, 2024 23:11 Inactive
@spokenbird spokenbird temporarily deployed to il-gcc-ccap-493-family--n4tpgk December 24, 2024 19:17 Inactive
@spokenbird spokenbird temporarily deployed to il-gcc-ccap-493-family--n4tpgk December 24, 2024 19:32 Inactive
@spokenbird spokenbird force-pushed the ccap-493-family-confirmation-email branch from 42994ee to 76c5aab Compare December 24, 2024 19:36
@spokenbird spokenbird temporarily deployed to il-gcc-ccap-493-family--n4tpgk December 24, 2024 19:37 Inactive
@spokenbird spokenbird temporarily deployed to il-gcc-ccap-493-family--n4tpgk December 24, 2024 20:03 Inactive
@spokenbird spokenbird temporarily deployed to il-gcc-ccap-493-family--n4tpgk December 24, 2024 21:09 Inactive
@spokenbird
Copy link
Contributor Author

@cram-cfa
I've left this PR in a state where the sendgrid email functionality is fully working. The email will be sent when a user submits the contact-provider-message screen, to the email they entered in the flow.

Not fully implemented is the webhook which I haven't been able to get working. The webhook should provide asynchronous updates on email statuses from Sendgrid, to our applications endpoint. I can see pings to the endpoint in the Heroku logs, but the endpoint shows a 403 (unauthorized?) which I'm not sure if that means our application is saying Heroku is unauthorized or vice versa.

https://www.twilio.com/docs/sendgrid/for-developers/tracking-events/getting-started-event-webhook

https://www.twilio.com/docs/sendgrid/for-developers/tracking-events/getting-started-event-webhook-security-features

If we can get this working we should be able to implement retries when needed and a status table for emails.

@spokenbird
Copy link
Contributor Author

I also setup a Datadog alert if communicating with Sendgrid fails:
https://app.datadoghq.com/monitors/161103803

@enyia21 enyia21 temporarily deployed to il-gcc-ccap-493-family--n4tpgk January 6, 2025 15:38 Inactive
Sure.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@enyia21 enyia21 temporarily deployed to il-gcc-ccap-493-family--n4tpgk January 6, 2025 15:43 Inactive
@enyia21 enyia21 temporarily deployed to il-gcc-ccap-493-family--n4tpgk January 6, 2025 18:05 Inactive
@enyia21 enyia21 temporarily deployed to il-gcc-ccap-493-family--n4tpgk January 6, 2025 20:11 Inactive
@enyia21 enyia21 temporarily deployed to il-gcc-ccap-493-family--n4tpgk January 7, 2025 19:33 Inactive
@enyia21 enyia21 had a problem deploying to il-gcc-ccap-493-family--n4tpgk January 7, 2025 19:41 Failure
@enyia21 enyia21 temporarily deployed to il-gcc-ccap-493-family--n4tpgk January 7, 2025 19:43 Inactive
@enyia21 enyia21 temporarily deployed to il-gcc-ccap-493-family--n4tpgk January 7, 2025 19:46 Inactive
@enyia21 enyia21 temporarily deployed to il-gcc-ccap-493-family--n4tpgk January 7, 2025 19:52 Inactive
@enyia21 enyia21 temporarily deployed to il-gcc-ccap-493-family--n4tpgk January 7, 2025 19:55 Inactive
@enyia21 enyia21 temporarily deployed to il-gcc-ccap-493-family--n4tpgk January 7, 2025 19:59 Inactive
@enyia21 enyia21 temporarily deployed to il-gcc-ccap-493-family--n4tpgk January 7, 2025 20:03 Inactive
@enyia21 enyia21 temporarily deployed to il-gcc-ccap-493-family--n4tpgk January 7, 2025 20:10 Inactive
@enyia21 enyia21 temporarily deployed to il-gcc-ccap-493-family--n4tpgk January 7, 2025 20:12 Inactive
@enyia21 enyia21 temporarily deployed to il-gcc-ccap-493-family--n4tpgk January 7, 2025 20:24 Inactive
@enyia21 enyia21 temporarily deployed to il-gcc-ccap-493-family--n4tpgk January 7, 2025 21:40 Inactive
@enyia21 enyia21 temporarily deployed to il-gcc-ccap-493-family--n4tpgk January 7, 2025 22:10 Inactive
return;
}
String familyEmail = familySubmission.getInputData().get("parentContactEmail").toString();
if (familyEmail == null || familyEmail.isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if the family choses to be reached out by phone, this email value should be null

private Content createFamilyConfirmationEmailBody(Submission familySubmission, String confirmationCode, Locale locale) {
String parentFirstName = familySubmission.getInputData().get("parentFirstName").toString();
String emailLink = familySubmission.getInputData().get("emailLink").toString();
String ccrAndR = familySubmission.getInputData().get("ccrrName").toString();
Copy link
Contributor

@analoo analoo Jan 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is so exciting. Looking forward to setting ccrrName dynamically to test different providers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants