Start a conversation

How to Override Text in Email Templates

How to Override Text in Email Templates Using Partials

One area you might want to create text overrides for is email templates. One example is an email notification from your community letting members know they have a new message or replies to a topic they follow.

Working with template partials

Email templates are unique. They include references to common partial templates, avoiding the need to repeat the same information across multiple templates. You can create overrides for each language your community supports, and any changes made to one of these partials are applied to all email templates for that language.

This section will examine the three core partials used in email templates and how to use them in a text override.

Closing

The Closing partial typically consists of a signature and/or closing statement at the end of the email body.

componentId: mail.template.closing

Key Default value (English)
Closing.body {communityTitle} Team

If you want to change the closing message, you can do so by updating the value of the Closing.body key in the mail.template.closing component. Here's an example using a graphQL mutation:

Mutation

mutation createOrUpdateTextOverride($values: JSON!) {
    createOrUpdateTextOverride(componentId: "mail.template.closing", locale: "en-US", values: $values) {
        result {
            locale
            texts
        }
    }
}
{
"values":{
    "Closing.body" : "This is the custom closing."
    }
}

The Footer partial contains a link to the privacy policy page. This section will be hidden if the community has no policy page set.

componentId: mail.template.footer

Key Default value (English)
Footer.body.html We value your <a href="{policyUrl}">privacy</a>.
Footer.body.text View our privacy policy: {policyUrl}

Overriding the footer is done in much the same way as the closing. However, you'll notice both HTML and plain text versions of the footer are included. You can override both of these using a single mutation. Here's an example:

Mutation

mutation createOrUpdateTextOverride($values: JSON!) {
    createOrUpdateTextOverride(componentId: "mail.template.footer", locale: "en-US", values: $values) {
        result {
            locale
            texts
        }
    }
}
{
"values":{
    "Footer.body.html" : "This is the custom footer text.",
    "Footer.body.text" : "This is the custom footer text."
    }
}

Notifications Settings

The Notification Settings partial contains a link to the user notifications settings page to allow members to change their notification preferences.

componentId: mail.template.notificationsSettings

Key Default value (English)
NotificationsSettings.body.html Unsubscribe or manage notification settings
NotificationsSettings.body.text Unsubscribe or manage notification settings: {settingsUrl}

Here is an example of how this would be performed using a graphQL mutation:

Mutation

mutation createOrUpdateTextOverride($values: JSON!) {
    createOrUpdateTextOverride(componentId: "mail.template.notificationsSettings", locale: "en-US", values: $values) {
        result {
            locale
            texts
        }
    }
}
{
"values":{
    "NotificationsSettings.body.html" : "This is the custom settings text.",
    "NotificationsSettings.body.text" : "This is the custom settings text."
    }
}
Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. ATLAS

  2. Posted
  3. Updated

Comments