Message Templates

Overview

FusionAuth will use message templates to send codes to users who have chosen an SMS MFA method. This is currently the only built-in workflow which uses message templates.

You may also create your own message templates with localized content and manage them using FusionAuth.

Managing Templates

FusionAuth ships with a default message template to support SMS MFA workflows. However, it isn’t assigned to the SMS Multi-Factor settings. To use it, configure the Tenant Multi-Factor settings.

You may also add new templates. Either use the Message Template API or the administrative user interface by navigating to Customizations -> Message Templates .

Adding a message template

Base Information

Id

The unique Id of the Message Template. The template Id may not be changed and will be used to interact with the template when using the APIs.

Namerequired

The name of the template. This value is for display purposes only and can be changed at any time.

Typerequired

The type of the template. SMS is the only value currently supported.

Localization

The message template body can be localized.

You can associate the template text values with a locale. If a user has a preferred language, the localized template will be used when this text message is sent.

A localized message template for the German locale.

Templates & Replacement Variables

The message template body supports replacement variables. This means place holders can be inserted and the value will be calculated at the time the message template is rendered and sent to a user.

Most templates will contain the User object as returned on the Retrieve User API. This means you can utilize any value found on the User object such as email, first name, last name, etc.

Below you will find each stock template that FusionAuth ships for reference. The available replacement values will be outlined below for each template.

Default Two Factor Request

.Message

Two Factor Code: ${code}

Replacement Variables

applicationApplication

The Application object, see the Application API for field definitions.

codeString

A code that the user must provide to complete multi-factor authentication.

emailString

Email address associated with the user.

mobilePhoneString

Mobile phone number associated with the user.

tenantTenant

The Tenant object, see the Tenant API for field definitions.

userUser

The User object, see the User API for field definitions of a User.