Messaging Templates

This guide explains how to customize and manage messaging templates for various authentication methods and user invitations in Descope.

To learn how to use messaging templates for authentication within flows, refer to our Flow Actions Doc, and for user invites, refer to our User Invite Doc.

Creating Templates

Authentication Templates

To create an authentication template:

  1. Go to the settings of each respective Authentication Method in the Console
  2. Select your configured messaging connector (Email, SMS, Voice, or Instant Messaging)
  3. Click + New Template

Example of creating a new template for email authentication methods in Descope

User Invitation Templates

To create a user invitation template:

  1. Go to Sign Ups and User Invitations under Project Settings
  2. Select your configured messaging connector (Email or SMS)
  3. Click + New Template

Template Editor

The template editor supports both HTML (for Email) and plain text (for Email, SMS, Voice, or Instant Messaging) formats. They support dynamic content using the syntax {{}}. You can also preview the message by clicking the preview tab.

HTML Format

Example of a customized template for email authentication methods in Descope

Plain Text Format

Example of a plain text mode for email template in Descope

Template Localization

If you would like to translate your email or SMS depending on your user's location, you can set up template localization using the Descope console. Refer to the Localization Configuration Overview for more details.

Dynamic Content with Template Options

Template options allow you to pass dynamic data to your templates. You can set these options through both flows and SDKs.

You can access template options in your templates by prefixing the key with options_. For example:

options in messaging template

With Flows

  1. Select the message-sending action
  2. Click + to add template options
  3. Add key-value pairs for dynamic content

Using Template options within Descope flows

With SDKs

You can utilize the templateOptions parameter within the SDK authentication functions to set the template options values. The example below is for the the Sign Up Or In via magic link function using the Node SDK. Check out the specific SDK docs for each authentication method for more details on how to use template options.

index.js
const loginId = "email@company.com"
const uri = "http://auth.company.com/api/verify_magiclink"
const deliveryMethod = "email"
const signUpOptions = {
    "templateOptions": {
        "deviceOS": "Value",
        "startHostName": "Value2"
    }
}
 
const resp = await descopeClient.magicLink.signUpOrIn[deliveryMethod](
    loginId, 
    uri, 
    signUpOptions
);
 
if (!resp.ok) {
    console.log("Failed to initialize signUpOrIn flow")
    console.log("Status Code: " + resp.code)
    console.log("Error Code: " + resp.error.errorCode)
    console.log("Error Description: " + resp.error.errorDescription)
    console.log("Error Message: " + resp.error.errorMessage)
} else {
    console.log("Successfully initialized signUpOrIn flow")
}
Was this helpful?

On this page