Skip to main content

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

  1. Go to Tenant Settings > Appearance > Themes.

  2. Create a new theme or select an existing theme.

  3. Select the Messages tab.

  4. Expand SMS MESSAGES and select a template:

    TemplateDescription
    Activate Account With CodeSMS sent when a user activates their account with an OTP code.
    Activate Account With LinkSMS sent with an activation link.
    Address Verification With LinkSMS sent to verify a phone number.
    Identifier TakenSMS sent when a user tries to register with an identifier already in use.
    Verification CodeSMS sent with an OTP code for MFA verification.
    Reset Credentials With CodeSMS sent with a code to reset credentials.
    Reset Credentials With LinkSMS sent with a link to reset credentials.
  5. Select index.tmpl to open the template in the editor.

  6. Edit the template content. Templates use Go template syntax with translation keys and data variables.

  7. 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."

ElementDescription
{{ T "texts.otp.message" }}Inserts the localized message text from the translations layer.
.Data.OTP.CodeThe 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.

See also