Customize messages
When you create a theme, you can customize emails and text messages sent to users during various flows. For emails, you can adjust the base template, edit content, or create custom emails from scratch.
Note
Message customizations are applied individually to each theme. To learn more, see Create and bind themes.
Prerequisite
A custom theme created and bound to one or more workspaces.
Customize email messages
There are two ways you can customize email messages:
Edit the email message base template to define the base elements for all email messages.
For example, footer content.
Edit the components of individual email messages.
For example, the account activation email.
Edit base email template
Edit the base email template to change the appearance of all email messages. You can make small adjustments or build your own emails from scratch.
The following steps detail a sample scenario for editing the base email template to include a footer with social media links and icons.
In the theme HTML editor, go to Components >
base_email.tmpl
.Tip
To preview your changes, check any of the templates under Messages.
Find the
div
with thefooter-logo
class and add the following code beneath it:<div class="caption footer-caption"> FIND US ON: </div> <div class="caption"> <a href="https://twitter.com/CloudentityTEAM"> <img class="footer-image" src="https://www.svgrepo.com/show/416494/connect-media-networking.svg"> </a> <a href="https://github.com/cloudentity"> <img class="footer-image" src="https://www.svgrepo.com/show/416517/code-github-hosting.svg"> </a> </div>
Optional. Add styling with a
<style>
element. For example:<style type="text/css"> [...] .footer-image { max-height: 32px; margin: 5px; } [...] </style>
Save your changes.
Tip
If the Save button is inactive, check the console for errors.
To preview your changes, go to the Messages tab, and select an email template from the list.
For example, the Activate Account With Code template.
The following image shows the updated footer with social media links and icons:
Edit email messages
Edit the content of standard email messages before sending them to users.
The following steps detail a sample scenario for editing the content of the email users receive to activate their account with a code.
In the theme HTML editor, go to Messages > EMAILS.
Select the Activate Account with Code template.
Edit the HTML code of the email message.
For example, the following is the default message:
<div class="main-text">Just one more step to access it</div>
You can change it to:
<div class="main-text">Here is your account activation code!</div>
Save your changes.
Customize text messages
Edit the content of standard text messages before sending them to users.
In the theme HTML editor, go to Messages > SMS MESSAGES.
Select the SMS message template to edit and make your changes.
Save your changes.
Variables
Messages can also be customized with variables, allowing dynamic content to be inserted into the message. Simple variables, such as the One-Time Password (OTP) value, can be included, while more complex variables allow access to user-specific data, like their name, email, or other account details.
For example, to reference the first_name
entry from the user's payload, use:
{{ .Data.User.Payload.first_name}}
Available fields through the .Data
object:
Variable name | Description |
---|---|
OTP | One Time Password structure with data. |
User | User data. |
Entry structure for the OTP
variable:
Variable name | Description |
---|---|
Code | Plain text code. For example, |
ExtendedCode | Encrypted combination of user id and code. |
Link | Sends a login link instead of OTP value. |
Entry structure for the User
variable:
Note
When inserting user data into a template, remember that Payload and Metadata are JSON values and may vary for different pools, as they can be customized by schemas.
Variable Name | Description |
---|---|
TenantID | |
UserPoolID | |
UserID | |
Status | |
StatusUpdatedAt | |
Payload | User's payload in JSON format, which can be referenced using dot notation. |
PayloadSchemaID | |
Metadata | User metadata in JSON format, which can be accessed using dot notation. |
MetadataSchemaID | |
CreatedAt | |
UpdatedAt |