Include only email history in replies
Last Update: Oct 2024 • Est. Read Time: 5 MINBy default, the reply email template in Kustomer includes all messages in a conversation's history, including messages from other channels such as chat or SMS. This can be modified by creating a custom email template. The code sample below when entered in the Code Editor view will include email history only and exclude messages from other channels such as chat or SMS.
Who can access this feature? | |
User types | Admins can access the Email templates page. |
In this article:
- Prerequisites
- Add a new email template in the Code Editor
- Replace the template code
- Customize your email template
Prerequisites
- Familiarity with the basics of creating email templates and creating them in the Code Editor.
Add a new email template in the Code Editor
- Go to Settingsand select Administration > Email Templates.
- Select Add Template and select the Code Editor tab.
- Fill out the Template Name, select Email Reply as the template type and select Create.
Replace the template code
- In the Code Editor view that appears, click inside the Body section and delete the existing code.
- Copy and paste the code below into the Body section and save the template.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>{{lastMessage.subject}}</title> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <style> h1, h2, h3 { margin-top: 0; margin-bottom: 0; } p { margin-top: 5px; margin-bottom: 5px; } .kustomer_rows_container { max-width: 600px; min-width: 320px; } .kustomer_social_anchor { color: inherit; } .col-1 { width: 8.3%; } .col-2 { width: 16.6%; } .col-3 { width: 25%; } .col-4 { width: 33.3%; } .col-5 { width: 41.6%; } .col-6 { width: 50%; } .col-7 { width: 58.3%; } .col-8 { width: 66.6%; } .col-9 { width: 75%; } .col-10 { width: 83.3%; } .col-11 { width: 91.6%; } .col-12 { width: 100%; } </style> </head> <body dir="ltr" style="background-color: #f6f6f6; padding-top: 20px; padding-bottom: 20px;"> <table role="presentation" class="kustomer_rows_container" style="table-layout: fixed; border-spacing: 0; border-collapse: collapse; word-break: break-word; mso-table-lspace: 0pt; mso-table-rspace: 0pt;" width="100%" cellpadding="0" cellspacing="0" border="0" align="center"> <tbody> <tr> <td> <table cellpadding="0" cellspacing="0" border="0" width="100%" style="background-color: #FFF5F5; background-position: center; background-size: cover; padding-top: 20px; padding-bottom: 20px; padding-left: 20px; padding-right: 20px; " > <tbody> <tr> <td> <table cellpadding="0" cellspacing="0" border="0" class="col-12"> <tbody> <tr> <td> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <table cellpadding="0" cellspacing="0" border="0" width="100%" style="background-color: #ffffff; padding-top: 20px; padding-bottom: 20px; padding-left: 20px; padding-right: 20px; "> <tbody> <tr> <td> <table cellpadding="0" cellspacing="0" border="0" class="col-12"> <tbody> <tr> <td> <table cellpadding="0" cellspacing="0" border="0" word-break: break-word; width="100%"> <tbody> <tr> <td style="padding-top: 20px; padding-bottom: 20px;"> <h1 style="text-align: center">Hello!</h1> </td> </tr> </tbody> </table> <table cellpadding="0" cellspacing="0" border="0" word-break: break-word; width="100%"> <tbody> <tr> <td style="padding-top: 20px; padding-bottom: 20px;"> <div> {{{draft.htmlBody}}}{{#if user.emailSignature}} <br /> {{markdownToHTML user.emailSignature}}{{/if}} </div> <br /> {{#if messages.length}} <blockquote class="gmail_quote" style="margin: 0 0 0 0.8ex; border-left: 1px #ccc solid; padding-left: 1ex;"> {{#each messages}} {{#ifCond channel '==' 'email'}} <div class="gmail_quote"> <div dir="ltr"> On {{dateFormat ../sentAt format="ddd, MMM D, YYYY [at] h:mm A"}} <<a href="mailto:{{../from}}" {{#if @first}}{{else}} target="_blank" {{/if}}> {{../from}}</a>> wrote:<br /> </div> <blockquote class="gmail_quote" style="margin: 0 0 0 0.8ex; border-left: 1px #ccc solid; padding-left: 1ex;"> <div dir="ltr"> {{markdownToHTML ../body}} </div> {{#if @last}}{{else}} <br /> {{/if}} </blockquote> </div> {{/ifCond}} {{/each}} </blockquote> {{/if}} </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> <table cellpadding="0" cellspacing="0" border="0" width="100%" style="background-color: #FFF5F5; padding-top: 20px; padding-bottom: 20px; padding-left: 20px; padding-right: 20px; "> <tbody> <tr> <td> <table cellpadding="0" cellspacing="0" border="0" class="col-12"> <tbody> <tr> <td> <table cellpadding="0" cellspacing="0" border="0" word-break: break-word; width="100%"> <tbody> <tr> <td style="padding-top: 5px; padding-bottom: 20px;"> <span style="font-size: 11px; color: #222222">If you have any questions or complaints, we are here to help you. Contact us through our Help Center or through any of our social media platforms.</span> </td> </tr> </tbody> </table> <table cellpadding="0" cellspacing="0" border="0" width="100%"> <tbody> <tr> <td align="left"> <div> <table cellpadding="0" cellspacing="0" border="0"> <tbody> <tr> <td style="width: 20px; padding-right: 15px;"> <a rel="noopener noreferrer" target="_blank" class="kustomer_social_anchor" href="#"> <img style="width=100%" width=20 src="https://assets.kustomer.com/Icons/social-media/facebook-dark.png"> </a> </td> <td style="width: 20px; padding-right: 15px;"> <a rel="noopener noreferrer" target="_blank" class="kustomer_social_anchor" href="#"> <img style="width=100%" width=20 src="https://assets.kustomer.com/Icons/social-media/instagram-dark.png"> </a> </td> <td style="width: 20px; padding-right: 15px;"> <a rel="noopener noreferrer" target="_blank" class="kustomer_social_anchor" href="#"> <img style="width=100%" width=20 src="https://assets.kustomer.com/Icons/social-media/twitter-dark.png"> </a> </td> </tr> </tbody> </table> </div> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </td> </tr> </table> </body> </html>
3. When selecting Preview, your email template preview will look like the following:
Customize your email template
Your email responses to customers will now only include email messages and exclude those from other channels when using this reply template. See the Customize email templates article.
After adding your preferred customizations, Save all changes to the template. You are now ready to use the template in your emails and autoresponses.