Dynamic update of email templates for different client id's


We have a requirement where we need a provision to update email templates from the web portal for which we are utlizing Auth0 API - PUT /api/v2/email-templates/{templateName}.

Our Auth0 tenant can have more than one applications and we want to update template based on client id of the application and for others preserve the default behaviour.

After executing the API, I can see it replaces the entire body. Do we have any solution for this where it replaces only that part of html for that specific client id

Hi @mansi.srivastava ,

I think what you want to achieve is to conditionally work with the specific HTML tags instead of replacing the whole <html> ...</html> with your custom code once the condition is met.

Let’s say a user is resetting their password and for the application.clientID = ‘xyz’ you want the email to contain a sentence: “Please click the below link to reset your password” while for all the other applications you want to leave the already existing sentence unchanged.

Then you would edit the existing HTML script only in its relevant part (the relevant <p>...</p> tag).

<p>
{% if application.clientID=='xyz' %} 
Please click the below link to reset your password.
{% else %}
If it wasn't you please disregard this email and make sure you can still login to your account. If it
                was you, then <strong>confirm the password change <a href="{{ url }}">click here</a></strong
                >
{% endif %}
</p>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.