Configure SMS message templates
Customize the text messages delivered to users for OTP verification, account activation, and other authentication flows. SMS templates use the same theme editor as email and voice templates.
Prerequisite
- A custom theme created and assigned to one or more workspaces.
Edit SMS templates
-
Go to Tenant Settings > Appearance > Themes.
-
Create a new theme or select an existing theme.
-
Select the Messages tab.
-
Expand SMS MESSAGES and select a template:
Template Description Activate Account With Code SMS sent when a user activates their account with an OTP code. Activate Account With Link SMS sent with an activation link. Address Verification With Link SMS sent to verify a phone number. Identifier Taken SMS sent when a user tries to register with an identifier already in use. Verification Code SMS sent with an OTP code for MFA verification. Reset Credentials With Code SMS sent with a code to reset credentials. Reset Credentials With Link SMS sent with a link to reset credentials. -
Select index.tmpl to open the template in the editor.
-
Edit the template content. Templates use Go template syntax with translation keys and data variables.
-
Click Save.
SMS template syntax
SMS templates use the T function to pull localized text from the translations layer, combined with data variables passed in at render time.
For example, the default Verification Code template:
{{ T "texts.otp.message" (dict "Code" .Data.OTP.Code) }}
This renders as: "Dear Customer, 777777 is your single-use verification code."
| Element | Description |
|---|---|
{{ T "texts.otp.message" }} | Inserts the localized message text from the translations layer. |
.Data.OTP.Code | The OTP verification code value. |
(dict "Code" .Data.OTP.Code) | Passes the OTP code as a named parameter to the translation string. |
To change the message wording, edit the translation string in the theme's Translations section rather than the template file itself.
Organization variables
Account activation messages also carry the organization that owns the user's identity pool: .Data.Organization.ID, .Data.Organization.Name, .Data.Organization.Description, .Data.Organization.Color, and values from .Data.Organization.Metadata.
These variables are set only when the user's identity pool belongs to an organization, and only in the Activate Account With Code and Activate Account With Link templates. Anywhere else, .Data.Organization is not set, so always guard it:
{{ if .Data.Organization }}{{ .Data.Organization.Name }}: {{ end }}{{ T "texts.activate_account_with_code.message" (dict "Code" .Data.OTP.Code) }}
Without the guard, rendering fails instead of producing a blank value, and the message is never delivered to any user whose identity pool is not attached to an organization. The failure is reported as a message delivery failure, not as a template error, so test the template against a user in a regular workspace before you save it.
For a full description of each field, see Configure email templates.