Customizing Email/SMS Templates
Kii Cloud sends email and SMS messages in the following cases:
- When a new user verifies his email address or phone number.
- When a user reset his password.
You can change the content of the email and SMS messages by customizing the templates on the developer portal.
To customize, click the gear icon in the upper-right corner and then click the "Templates" icon.
Customizing the sender
You can change the sender of the email ("From" field) in the "General Template Settings" tab.
Customizing the email template
You can set the email templates in the "Email Templates" tab.
First, please specify the target locale and target template.
Locale
Specify the locale of the template you want to configure. The locale is to be set in BCP 47 format. A list of locale candidates will show up as you type a letter in the form. You can select the target locale from this list.
The template applied when sending emails to the user is decided by the
locale
field of the user attribute. The template is decided by matching the locale name in the longest match manner. If there are three templates for the localesen
,zh
, andzh-Hans
, for example, the template forzh-Hans
will be applied to the user who has the localezh-Hans-HK
being set. If there is no template that matches with the user locale, the template set for the "en" will be applied.Template name
Select the template to customize.
- Email Verification: Template for the verification email.
- Email Verification Completed: Template for the verification completion email.
- Password Reset (Email): Template for the assword reset email.
- Password Reset Successful (Email): Template for the passowrd reset completion email.
Next, please set the email title and body.
The email body can be set either in text or in HTML format.
You can use placeholders in the title and body. The following placeholders are available for each template.
Placeholder | To be replaced with | Email Verification Template | Email Verification Completed Template | Password Reset (Email) Template | Password Reset Successful (Email) Template |
---|---|---|---|---|---|
${app.appID} | The AppID of the application | x | x | x | x |
${user.displayName} | The display name of the user | x | x | x | x |
${user.userID} | The UserID of the user | x | x | x | x |
${user.loginName} | The login name of the user | x | x | x | x |
${url} | The verification link or password reset link (usable only in "body") | x | x | ||
${user.unverifiedEmailAddress} | The unverified email address of the user | x | |||
${user.emailAddress} | The verified email address of the user | x | x | x | |
${password} | New passowrd (usable only in "body") | x |
Please put a space before and after a placeholder, especially when you are using ${url}. The link in the email body may not work properly if there is no space.
Make sure that ${password} is included in the password reset completion email template, or your user will not be able to know the new password.
The placeholders in the verification email will be replaced with the values that are set when the user registration API is executed. The placeholders in the password reset email will be replaced with the values that are set when the password reset API is executed. The placeholders in the verification completion email and password reset completion email will be replaced with the values that are set when the corresponding link is clicked. For all cases, an empty string will be inserted for the display name and login name if they are not set.
Press the "SAVE" button when all settings are done.
Customizing SMS templates
You can set the SMS template in the "SMS Templates" tab.
Select the template to customize.
- Phone Number Verification: Template for the phone number verification SMS message.
- Password Reset (SMS): Template for the password reset SMS message.
- Password Reset Successful (SMS): Template for the password reset completion SMS message.
Setting the SMS template per locale will be supported soon. For now, the SMS template set in this UI will be applied to all users.
Next, please set the SMS message. The following placeholders are available for each template.
Placeholder | To be replaced with | Phone Number Verification Template | Password Reset (SMS) Template | Password Reset Successful (SMS) Template |
---|---|---|---|---|
${code} | The verification code | x | ||
${valid} | The period of validity of the verification code (in hour) | x | ||
${url} | A link for resetting the password | x | ||
${password} | A new password | x |
Make sure that ${password} is included in the password reset completion SMS template, or your user will not be able to know the new password. Also, please put a space before and after a placeholder, especially when you are using ${url}. The link in the SMS message may not work properly if there is no space.
Press the "SAVE" button when all settings are done.
Note: Some devices split a long SMS message into multiple messages, so we recommend you to put ${url} placeholder at the front of the template so as to prevent the link from being split.
Also, some mobile carriers filter SMS messages with URLs. You might need to guide the application users to set such a filtering off in some cases.