Message Template Reference
On this page
Each page in this section covers one message template: when FusionAuth sends the message, where you assign the template, an example, and every replacement variable the template receives. To write and manage templates, see Create a Message Template.
How FusionAuth Delivers Messages#
FusionAuth renders the template to text and hands the text to a messenger. The Generic messenger posts the text to an HTTP endpoint that you run, so you can forward the message to any service that reaches users by phone number. FusionAuth addresses every message to a phone number, and sends a message only when the recipient has one.
Set the messenger for account and security messages in Tenants -> Your Tenant -> Identities -> Messaging settings . The Admin UI lists the message templates in the Phone column on the same tab. Two-factor messages use their own messenger and templates on the Multi-Factor tab.
Default and Example Templates#
FusionAuth ships default templates for many workflows. A new FusionAuth instance lists the defaults in Customizations -> Message Templates , with names that start with [FusionAuth Default]. An instance set up with Kickstart has no defaults, so add the templates you need in the Kickstart file. The page for each of those templates shows the default.
FusionAuth ships no default for the other templates, such as Identity Update and Password Update. FusionAuth sends those messages only after you create a template and assign the template. The page for each of those templates shows an example to start from.
Retrieve the Templates as Files#
The default templates live in extractedcode/templates-messengers in the docs repository, and the examples live in extractedcode/templates-messengers-examples. To download every default template at once:
$ npx degit FusionAuth/fusionauth-site/astro/extractedcode/templates-messengers templates-messengers
Without Node, pull the same folder out of a repository tarball:
$ curl -L https://github.com/FusionAuth/fusionauth-site/archive/refs/heads/main.tar.gz \
| tar -xz --strip-components=4 fusionauth-site-main/astro/extractedcode/templates-messengers
Either command writes the templates into a templates-messengers directory. To download the examples, replace templates-messengers with templates-messengers-examples in either command.
Replacement Variables#
Every template receives tenant, baseUrl, and phoneNumber, the phone number of the recipient. Most templates also receive user. Templates receive application when the request that sends the message identifies an Application. Templates that FusionAuth sends for an event also receive event, the same object a webhook receives for that event.
A variable can be missing or null, so check optional values with the FreeMarker ?? operator, or give a default with !:
[#if application??]
Welcome to ${application.name}.
[/#if]
Hello ${user.firstName!'there'}.
The template preview in the Admin UI renders with sample data. The sample data has no phoneNumber, and the sample event is a User Login New Device event. A template that uses phoneNumber or other event fields shows an error in the preview but renders when FusionAuth sends the message. The examples in this section use user.phoneNumber where the value matches, so the examples preview cleanly.
Templates#
Account
Forgot Password
Learn when FusionAuth sends the forgot password message, and which variables the template receives.
Passwordless Login
Learn when FusionAuth sends the passwordless login message, and which variables the template receives.
Set Up Password
Learn when FusionAuth sends the message that asks a new user to set a password, and which variables the template receives.
Verification
Learn when FusionAuth sends the message that verifies a user's phone number, and which variables the template receives.
Verification Complete
Learn when FusionAuth sends the message that confirms a verified phone number, and which variables the template receives.
Security Notifications
Admin Two-Factor Method Removed
Learn when FusionAuth sends the message that tells a user an administrator removed a two-factor method, and which variables the template receives.
Identity Update
Learn when FusionAuth sends the message that tells a user their phone number changed, and which variables the template receives.
Login Id Duplicate on Create
Learn when FusionAuth sends the message that tells a user someone tried to sign up with their login Id, and which variables the template receives.
Login Id Duplicate on Update
Learn when FusionAuth sends the message that tells a user another account tried to take their login Id, and which variables the template receives.
Password Reset Success
Learn when FusionAuth sends the message that confirms a password reset, and which variables the template receives.
Password Update
Learn when FusionAuth sends the message that tells a user their password changed, and which variables the template receives.
Threat Detected
Learn when FusionAuth sends the message about a new device or suspicious login, and which variables the template receives.
Two-Factor Authentication
Learn when FusionAuth sends the message with a multi-factor code, and which variables the template receives.
Two-Factor Method Added
Learn when FusionAuth sends the message that tells a user a two-factor method was added, and which variables the template receives.
Two-Factor Method Removed
Learn when FusionAuth sends the message that tells a user a two-factor method was removed, and which variables the template receives.
Related
Learn about the email templates FusionAuth sends and the replacement variables each template receives.
Learn when FusionAuth sends the email that contains a two-factor code, and which variables the template receives.
Learn when FusionAuth sends the message with a multi-factor code, and which variables the template receives.
API documentation for the FusionAuth Create an Email Template API.