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

Support ability to use email templates from Mailgun #1865

Closed
NevilleS opened this issue Nov 28, 2022 · 3 comments · Fixed by #2039
Closed

Support ability to use email templates from Mailgun #1865

NevilleS opened this issue Nov 28, 2022 · 3 comments · Fixed by #2039
Assignees

Comments

@NevilleS
Copy link
Contributor

NevilleS commented Nov 28, 2022

Description

Our current email notifications are essentially only useful for testing; we need better templates to use for production use cases. We could write our own HTML templates for this, but we'd quickly end up wanting to provide a lot of configuration options for those templates which is a lot of work!

Meanwhile, both of our messaging providers support their own email editors to design & build transactional email templates:

For example, our current emails look like this:
image

Meanwhile, Mailgun's editor looks like this (gives users a ton of control!):
image

...with the ability to insert template variables like:
image

Assumptions

  • A single email template should be sufficient for all our emails at first
  • Each email notification would have template variables for "subject" and "message"

Acceptance Criteria

  • Add support for using Mailgun templates for all email notifications (identity verification, request receipt, request review, request completion)
  • Add ability to automatically populate Mailgun with a default "Fides" template (if the user does not want to create their own)
  • Add support for using Twilio templates for all email notifications (identity verification, request receipt, request review, request completion)
  • Add ability to automatically populate Twilio with a default "Fides" template (if the user does not want to create their own)

Implementation Notes/Details

For an example of how the Mailgun API works:

curl -s --user 'api:YOUR_API_KEY' \
https://api.mailgun.net/v3/YOUR_DOMAIN_NAME/messages \
-F from='Sender Bob <sbob@YOUR_DOMAIN_NAME>' \
-F to='[email protected]' \
-F subject='Hello' \
-F template='template.test' \
-F t:variables='{"title": "API documentation", "body": "Sending messages with templates"}'
@mfbrown
Copy link

mfbrown commented Nov 28, 2022

Some questions we need to answer first:

  • Does our current domain sending key allow us to use an existing template and template variables?
  • Our domain sending key might not allow us to create a default template, can we just send the full default email HTML OR hard code a template name?

Other notes:

  • If sending the email fails because of a template issue, then differentiate that error from other existing errors - so that we can tell the user how to correct the error.

@mfbrown mfbrown changed the title Support ability to use email templates from Mailgun / Twilio Support ability to use email templates from Mailgun Nov 28, 2022
@mfbrown
Copy link

mfbrown commented Nov 28, 2022

Also - we should spend some time researching the Twilio/SendGrid API and ensure that we build this with as much commonality as possible.

#1866

@NevilleS
Copy link
Contributor Author

Some responses...

Does our current domain sending key allow us to use an existing template and template variables?

We can test that out but I believe so. However, just to clarify an important point: if a user sets up their own Mailgun account and their own Fides instances, they can generate as many API keys as they like, and that should be the primary use case we plan for. Using a domain sending key is a special case where you want to use a single Mailgun account across multiple domains 👍

Our domain sending key might not allow us to create a default template, can we just send the full default email HTML OR hard code a template name?

We can't continue to send the "default email HTML", because it's not styled enough. However, we definitely could "hardcode" a default template name and provide docs that tell a user how to manually create their own template using the Mailgun UI. It looks like this, so it's pretty functional to start from scratch if they must:
image

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

Successfully merging a pull request may close this issue.

3 participants