Skip to Content
🎉 New release with new features and improvements! V0.0.4 Release →

Email Templates

Bsh Engine allows you to create email templates to send emails to your users, this allow yout to set a templates that you can use to send emails without need to write the email content every time.

Email Templates

When you start the engine, it will create default email templates for authentication operations (activation, reset password, etc.).
You can edit them to customize the content of the emails.

Create an Email Template

Create Email Template

PropertyDescriptionRequireddefault
NameThe name of the email templateYes~
SubjectThe subject of the email templateYes~
BodyThe body of the email templateYes~
HTMLWhether the email template is HTMLNofalse

Template Variables

Bsh Engine allows you to use variables in your email templates to personalize the email content, the syntax is {{variableName}}.

for the authentication operations templates, you can access the user information like this:

Hello {{profile.firstName}} {{profile.lastName}}, Welcome to our application. Your email is: {{email}} and temporary password is: {{password}} If you have any questions, please contact us at support@example.com.

When using a templates with variables to send emails, you must pass the data object with the variables values.
Read more about Send Email endpoint.

Authentication Templates

Bsh Engine provides default email templates for authentication operations (activation, reset password, etc.). You can edit them to customize the content of the emails.

Sent when:

  • User registers themselves
  • Admin initializes a user with a password

Data Object:

{ "userId": "<user-id>", "status": "REQUIRED_ACTIVATION", "email": "<user-email>", "roles": ["<user-roles>"], "profile": { "firstName": "<user-first-name>", "lastName": "<user-last-name>", "...": "..." }, "activationCode": "<activation-code>" }

Sent when:

  • Admin initializes a user with an auto-generated password

Data Object:

{ "userId": "<user-id>", "status": "REQUIRED_ACTIVATION", "email": "<user-email>", "roles": ["<user-roles>"], "profile": { "firstName": "<user-first-name>", "lastName": "<user-last-name>", "...": "..." }, "activationCode": "<activation-code>", "password": "<generated-password>" }

Sent when:

  • User activates their account

Data Object:

{ "userId": "<user-id>", "status": "ACTIVATED", "email": "<user-email>", "roles": ["<user-roles>"], "profile": { "firstName": "<user-first-name>", "lastName": "<user-last-name>", "...": "..." } }

Sent when:

  • User requests a new activation code

Data Object:

{ "userId": "<user-id>", "status": "REQUIRED_ACTIVATION", "email": "<user-email>", "roles": ["<user-roles>"], "profile": { "firstName": "<user-first-name>", "lastName": "<user-last-name>", "...": "..." }, "activationCode": "<activation-code>" }

Sent when:

  • User requests a password reset

Data Object:

{ "userId": "<user-id>", "status": "REQUIRED_RESET_PASSWORD", "email": "<user-email>", "roles": ["<user-roles>"], "profile": { "firstName": "<user-first-name>", "lastName": "<user-last-name>", "...": "..." }, "resetPasswordCode": "<reset-password-code>" }

Sent when:

  • User resets their password via the reset password flow
  • User changes their password from their profile page

Data Object:

{ "userId": "<user-id>", "status": "ACTIVATED", "email": "<user-email>", "roles": ["<user-roles>"], "profile": { "firstName": "<user-first-name>", "lastName": "<user-last-name>", "...": "..." } }

Sent when:

  • Admin invites a new user

Data Object:

{ "userId": "<user-id>", "status": "REQUIRED_ACTIVATION", "email": "<user-email>", "roles": ["<user-roles>"], "profile": { "firstName": "<user-first-name>", "lastName": "<user-last-name>", "...": "..." }, "activationCode": "<activation-code>", "password": "<generated-password>" }

Sent when:

  • A new API key is created

Data Object:

{ "id": "<api-key-id>", "name": "<api-key-name>", "type": "<api-key-type>", "status": "<api-key-status>" }

Sent when:

  • An API key is revoked

Data Object:

{ "id": "<api-key-id>", "name": "<api-key-name>", "type": "<api-key-type>", "status": "<api-key-status>" }

Sent when:

  • An API key is deleted

Data Object:

{ "id": "<api-key-id>", "name": "<api-key-name>", "type": "<api-key-type>", "status": "<api-key-status>" }

Host Variable

you can access host from environment with placeholder {{host}}