FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login

    Email Template URL Calculation

    Scheduled Pinned Locked Moved
    Q&A
    email templates url
    0
    4
    2.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      jim.sadden
      last edited by

      Hello,

      My company uses FusionAuth's email templates for many tenants. We would like for each tenant to be able to point to several URLs through the email templates and for a calculation of the URL to be done within the template using Freemarker's replacement variables.

      For example, a link in the email sent from tenant A should point to domains a.com and b.com and the choice of which to point to should be done dynamically depending on the site which sent the request.

      Currently, this is made possible on forgot-password email requests through the passing of a state variable which contains the URL (or anything else). Unfortunately, the API does not allow for the passing of this state variable for other email requests, such as verify-email requests, which only allow access to the tenant and user objects.

      And so, we've had to hard-code the URL into the email templates without a state variable, and tenants can only point to one domain as a result.

      Is there a way to do this dynamic URL calculation in the email templates for email-verification, etc, which do not have this state variable?

      1 Reply Last reply Reply Quote 0
      • joshuaJ
        joshua
        last edited by

        @jim-sadden

        In thinking about this, this almost sounds like a feature/extension. I will run this by my colleagues to see if they have any thoughts on it or a workaround/different approach!

        Thanks,
        Josh

        1 Reply Last reply Reply Quote 0
        • joshuaJ
          joshua
          last edited by

          Hi @jim-sadden,

          After discussing this further, you may have few options (both with considerations and drawbacks) by either using the user object (which is available in some of the templates) and stuffing redirect/URL information in a custom user.data 'holder'. Another option, if your design allows for it, is to add additional tenants to allow for different forms to be used with different hardcoded URLs.

          Of course, if this still does not meet your use case requirements feel free to log a feature request for our development team to consider.

          I hope this helps!

          Thanks,
          Josh

          1 Reply Last reply Reply Quote 0
          • robotdanR
            robotdan
            last edited by

            A couple of options:

            1. You could optionally configure a different template for each tenant so you could hard code the correct URL in each template.

            2. You could also add the correct URL to the tenant.data and then pull it out in the template during render so you could use the same template across tenants.

            3. If the state parameter is working well for you for other APIs, you could open a feature request in GH to add this to the API in question.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post