Sending Multi Language Emails from Actions

Overview

Actions are limited to 100kb when sending notifications to end users, which can mean that the email contents are too large for the action when trying to support multiple languages. See Actions Limitations for more details on Action Limits. This article will provide a few potential workarounds to support multiple languages.

Applies To

  • Actions
  • Email sending

Solution

The email provider in use may support dynamic templates, allowing most of the email contents to be stored outside of the Action. This requires only the bare minimum user or transaction-related data to be passed in an API call to the Email Provider’s Email API, using, for example, the Axios library.

E.g., Sendgrid supports dynamic templates:

Please note when calling external APIs in Actions, explicit timeouts should be used so that, in the event the API is unresponsive, this can be caught more gracefully and exit the Action before the webtask container expires (~20 seconds):

If the email provider does not support dynamic email templates, an alternative approach could be to have the Action trigger a service outside of Auth0 that can process the email sending, such as using the “Axios” library to call a custom external endpoint or to redirect the user in the Action to an external site that can perform the necessary steps, before resuming the login flow: