Registration Email Templates: Access to the application name?
-
Hello,
Working on our integration with FA - On the email templates, for template registration verification
https://fusionauth.io/docs/v1/tech/email-templates/email-templates/#registration-verification
There is a UserRegistration object, Tenant object and User object - but what about an Application object? In our email template, we would like to include what the application name is that the user is being invited to use.
Second part of the question: Can we use these variables in the subject lines? This way we could create unique subjects per application? IE: You have been invited to use '<app.name>'
We are using the verified flag on the registration to ensure a user opts into an application via email, even if they are granted access via admin interfaces.
~Travis
-
what about an Application object?
That is not currently available. Because of the way the registration verification email is sent, I don't think there's any way to make this available at present.
Options I can think of:
- file a feature request: https://github.com/fusionauth/fusionauth-issues/issues
- disable FusionAuth sending the registration email automatically. Instead, subscribe to a webhook which receives the registration created event, and then can call the API to send the registration verification email manually, with the Send Email API. That will allow you to populate arbitrary values in the
requestData
field, including the application name.
I get that the second solution isn't optimal but it may be a viable workaround. I'd encourage you to file an issue either way, as exposing the
application
object may be something the community values, and filing an issue will let them vote on it.Can we use these variables in the subject lines?
Yup. Here's a post on customizing the subject lines (for a different email template, but it should be the same functionality):
Also, from https://fusionauth.io/docs/v1/tech/email-templates/email-templates/#registration-verification
The email template body, subject and from name fields support replacement variables.
-
Another option is to use an email template specific to the application so you can hard code the Application name. This works if you create the user and register them at the same time.
-
@travis-whidden opened this issue : https://github.com/FusionAuth/fusionauth-issues/issues/976
-
Sweet. Much appreciated. We were talking about making individual app templates, but that can get out of control especially for updates / changes. We do prefer to use one template for it --- across all the applications.
I'll stay-tuned for that enhancement.
Thanks!
-
@travis-whidden this functionality was released in 1.21.0: https://fusionauth.io/docs/v1/tech/release-notes/#version-1-21-0
Please give it a whirl and provide feedback if it meets your needs (or doesn't).
-
Works perfectly. Much appreciated!