Data attributes available for email templates
Last Update: Sep 2024 • Est. Read Time: 2 MINEmail templates have access to the following data in any Handlebars block:
- Agent Avatar
- Draft data attributes
- Customer data attributes
- User data attributes
- Conversation data attributes
- Message data attributes
For more information about email templates, see Custom email templates.
Agent Avatar
You can dynamically populate an email template with the avatar of the respective user, or agent. Use the following template to insert the agent avatar:
{{#if user.avatarUrl}} <img style="height:100px;width:100px;" alt="25" src="{{user.avatarUrl}}"/>{{/if}}
Notes:
- You can adjust the height and width of the avatar to fit your template.
- The email template won't display an avatar if an agent avatar is unavailable.
Draft data attributes
Important: Always include Draft data attributes to send the email draft typed by the agent. Email templates without these Draft Handlebars will send blank templates.
Handlebars template | Description |
{{draft.textBody}} | Plain text body of the email draft |
{{draft.htmlBody}} | Formatted HTML body of the email draft |
Customer data attributes
Handlebars template | Description |
{{customer.email}} | Primary email of the customer |
{{customer.name}} | Full name of the customer |
{{customer.firstName}} | First name of the customer, if available |
{{customer.lastName}} | Last name, if available |
{{customer.id}} | Unique ID of customer in Kustomer |
{{customer.custom.exampleCustomFieldStr}} | Custom data attribute specific to the Customer Klass for your Kustomer organization. |
User data attributes
Handlebars template | Description |
{{user.email}} | Email address of the user, or agent |
{{user.emailSignature}} | Email signature of the user, or agent |
{{user.name}} | User's name (as it appears in Kustomer) |
{{user.displayName}} | Public display name of the user, or agent. Defaults to the user's name if a display name is not set in Kustomer. |
{{user.id}} | Unique ID of the user, or agent, in Kustomer |
{{user.avatarURL}} | URL of the user, or agent's, avatar in Kustomer |
Note: The email template won't display an avatar if an agent avatar is unavailable.
Conversation data attributes
Handlebars template | Description |
{{conversation.status}} | Status of the conversation |
{{conversation.name}} | Name, title, or subject of the conversation |
{{conversation.id}} | Unique ID of the conversation in Kustomer |
{{conversation.custom.exampleCustomFieldStr}} | Custom data attribute specific to the Conversation Klass for your Kustomer organization |
Message data attributes
The following examples assume the first (most recent) message, which always has an index of [0]
. The second, or next recent message, will have an index of [1]
.
The Messages object is a list of historical messages in the Conversation object. You can loop over each message in the messages object with the built-in each Handlebars helper.
Handlebars template | Description |
{{messages.[0].channel}} | Channel of the message |
{{messages.[0].body}} | Body of the message |
{{messages.[0].direction}} | Direction of the message (either inbound or outbound |
{{messages.[0].from}} | Address from which the message was sent |
{{messages.[0].sentAt}} | Date and time when the message was sent |
{{messages.[0].subject}} | Subject of the message, if applicable |
{{messages[0].id}} | Unique ID of the message in Kustomer |