Emails¶
Emails are sent via Elastic Email. There is a set of defined templates in several languages with placeholders. Backend sends an email specifying the template id and populates merge data which elastic uses to replace placeholders in templates.
List of supported emails¶
export type EmailId =
'01_welcome' |
'02_tips' |
'03_lightning' |
'04_lightning_success' |
'05_lightning_refund' |
'05_lightning_refund_address' |
'06_debt-reminder' |
'07_group-debt-reminder' |
'08_group-archival-reminder-settled' |
'09_group-archival-reminder-unsettled';
Supported languages¶
List of languages for each template (some templates might be translated to various languages) is defined in remote config. When a translation is finalized in Weblate a new template is created in Elastic (manually) and this language is added to remote config. The id of the template should match {id}_email-name_{locale}, e.g.:
01_welcome-email_cs
Scheduling¶
Backend can schedule emails to be sent later. This is used for example for the Tips email, which is sent 1 week (set via Remote Config) after a user creates an account. Backend then iterates through the following list periodically and sends those emails at a given time.
"emailsInternal": {
"2022031015": {
"02_tips": {
"user_id_1": true
}
}
}