Appearance
Templates
Reading – More information on Templates is available
- API Basics Templates article.
- Twig's official documentation.
Currently, only the confirmation email can be templated.
Create your templates
We expect two formats, an HTML template and a TXT template.
The second one is used as a fallback for email clients that don't support HTML, and for screen readers. Although not mandatory, it is strongly recommended to also upload a TXT template.
To retrieve the list of available variables within the confirmation email template, you can use the following endpoints:
GET /customization/templates/email.user.onboarding_confirmation_{html|text}
GET /customization/templates/email.user.password_change{html|text}
Best practice – Keep the confirmation link variable
The confirmation_link
variable must always be present. It is the URL a user is asked to visit to activate their account.
HTML example
twig
<html>
<body>
<h1>
Welcome
</h1>
<p>
Please click <a href="{{ confirmation_link }}">on this link</a> to validate your account.
</p>
</body>
</html>
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
Like other files, your templates must be Base64 encoded.
base64
PGh0bWw+Cgk8Ym9keT4KCQk8aDE+CgkJCVdlbGNvbWUKCQk8L2gxPgoJCTxwPgoJCQlQbGVhc2Ug
Y2xpY2sgPGEgaHJlZj0ie3sgY29uZmlybWF0aW9uX2xpbmsgfX0iPm9uIHRoaXMgbGluazwvYT4g
dG8gdmFsaWRhdGUgeW91ciBhY2NvdW50LgoJCTwvcD4KCTwvYm9keT4KPC9odG1sPg==
1
2
3
2
3
TXT example
twig
Welcome
Please click the following URL to validate your accont
{{ confirmation_link }}
1
2
3
4
5
2
3
4
5
Like other files, your templates must be Base64 encoded.
base64
V2VsY29tZQoKUGxlYXNlIGNsaWNrIHRoZSBmb2xsb3dpbmcgVVJMIHRvIHZhbGlkYXRlIHlvdXIg
YWNjb250Cgp7eyBjb25maXJtYXRpb25fbGluayB9fQ==
1
2
2
Upload your templates
Your templates must be uploaded to the PUT /customization/templates/email.user.onboarding_confirmation_{html|text}
endpoint.
Example
Note that both HTML and TXT templates are uploaded at the same time.
bash
curl -X PUT {baseUrl}/customization/templates/email.user.onboarding_confirmation_{html|text}/template \
-H 'Authorization: Bearer {accessToken}' \
-H 'Content-Type: application/json' \
-d '{
"template": "{base64EncodedTemplate}"
}'
1
2
3
4
5
6
2
3
4
5
6
Caution – Replacing a Template
- Takes effect immediately.
- Cannot be undone.
Retrieve your template
To retrieve the template you already uploaded, you can use the GET /customization/templates/email.user.onboarding_confirmation_{html|text}
endpoint.
Example
bash
curl -X GET {baseUrl}/customization/templates/email.user.onboarding_confirmation_{html|text} \
-H 'Authorization: Bearer {accessToken}' \
-H 'Content-Type: application/json'
1
2
3
2
3
Testing your template
To test your template with dummy values you can use the GET /customization/templates/email.user.onboarding_confirmation_{html|text}/demo
endpoint.
Example
bash
curl -X GET {baseUrl}/customization/templates/email.user.onboarding_confirmation_{html|text}/example \
-H 'Authorization: Bearer {accessToken}' \
-H 'Content-Type: application/json'
1
2
3
2
3
Errors
Check out possible errors here