LinkedIn
Copied!

Table of Contents

Creating outbound email templates

To ensure better and customized branding in Pega Email Bot™ when interacting with customers, you can specify how sent emails look by creating new templates to fit the needs and requirements of your organization. As a result, automatic acknowledgment emails from the email bot or the emails that customer service representatives (CSRs) send always have a consistent look and feel that corresponds to your company branding.

Create an Email channel in the system. For more information, see Creating an Email channel.

To define a new outbound email template with a <template_name> name, you can take two different approaches. You can create a copy of one of the built-in templates that is closest to the desired end result by first finding the four rules for the outbound email templates by searching for _Classic, _Cobalt, or _Clear in the system. You then copy the four rules keeping them in the same class, removing the py prefix and appending <template_name>. Pega recommends this approach of copying the four rules and updating them to fit the requirements of your organization. Alternatively, you can create all four rules from scratch. The four rules for the new outbound email template you create must include the <template_name> suffix so that later you can select the new template during Email channel configuration.

If you create all four rules from scratch, to use the secure built-in threading mechanism for tracking email replies in the correct email thread for a triage case, add the following tag in the HTML source for your new EmailFormat_<template_name> rule:

<pega:include name="pyEmailThreadIdentification" type="Rule-HTML-Paragraph"></pega:include>

Because you define this HTML tag in the rule, the system embeds an encrypted security code in the email body to help track email replies in the correct email thread for a triage case. The built-in templates already include this HTML tag in the rule. For more information, see Understanding the email triage process.

If you upgrade from Pega Platform version 8.5 or earlier, in which you configured email channel, for the initial acknowledgment email, update the service method for your email listener rule. On the Response tab for the service email rule you specify the rule that defines the structure of the content of the email body. In Pega Platform 8.6 and later, you use for this purpose the pyEmailAcknowledgement correspondence rule that takes into account the selected template and includes the security code tag. If your application uses a different rule, update this definition to match one of the built-in correspondence rules, for example, EmailAckTemplate_Clear.
Section EmailFormat_<template_name> - @baseclass
Defines a wrapper with HTML tags for your acknowledgment and reply outbound email templates. The system uses the HTML within this section as the template for the associated Correspondence rules. You typically define in this rule the heights and widths of the areas of the email as well as the background colors. You also designate in the rule the header, body, and footer section of the email by using the data-pega-region attribute applied to a div tag.
Section EmailReplyBody_<template_name> - @baseclass
Defines a standard section to include as the email body in your reply outbound email template. This section must include the code that iterates over the EmailConversations pagelist and builds up the HTML for the email reply in a thread. The system adds each email in the conversation thread in its own table so that the system can style the email.
Correspondence EmailReplyTemplate_<template_name> Email - @baseclass
Defines the email outbound reply template that uses the EmailFormat_<template_name> as the format and EmailReplyBody_<template_name> as the primary content body. You also specify the logo HTML in the header and copyright string in the footer in this rule.
Correspondence EmailAckTemplate_<template_name> Email - Work-
Defines the email outbound acknowledgment template that uses the EmailFormat_<template_name> as the format and the pyEmailAckBody section rule as the primary content body. You specify the logo HTML in the header and copyright string in the footer in this rule.
The procedure shown below describes the steps required to create a new template using the recommended method of copying an existing version of the four outbound email templates. The steps cover copying the built-in Cobalt template to Green.
  1. Switch to Dev Studio.

  2. Create a new email format template with EmailFormat_<template_name> as a section rule:

    1. In the search field, enter _Cobalt

      The following are the search results for the four Cobalt outbound template rules of the correspondence and section type:
      The default Cobalt outbound template rules
      The search results for the default Cobalt outbound template
                                        rules.
    2. In the search results, click pyEmailFormat_Cobalt.

    3. Click the HTML tab, and in the HTML source field change the HTML to represent your company branding.

      To use a green theme for a company called Acme, you can change the title tag text to Acme Green Email Template, change the copyright information text in the footer to Copyright 2020 Acme Inc., and search for CSS background property for the Cobalt color (#1355B2 HEX value) and replace it with the a green color (#32a644 HEX value).
    4. Click Save as, and then click Save as.

    5. In the Section Record Configuration section, in the Label field, enter a title for the rule.

      For an email format template for a green theme, enter Green email format.
    6. Click Edit next to the Identifier field, enter an identifier name in the following format: EmailFormat_<name>, and then click OK.

      For an email format template for a green theme, enter EmailFormat_Green.
      The new email format template label and identifier
      The new email format template label and identifier
                                        representing the green theme.
    7. Click Create and open.

      The system saves the email format template as a section rule for the @baseclass class.
  3. Create a new EmailReplyBody_<template_name> rule to include in your reply outbound email template:

    1. In the search field, enter _Cobalt

    2. In the search results, click pyEmailReplyBody_Cobalt.

    3. Optional:

      To change the reply body template information, click the HTML tab, and then in the HTML source field change the HTML so that it is consistent with your company branding.

      This rule contains a combination of inline Java and HTML code. If you modify this code, you might break how the system renders the email reply body. You can only change the information within the style tags of the HTML elements for the rule.
    4. Click Save as, and then click Save as.

    5. In the Section Record Configuration section, in the Label field, enter a title for the rule.

      For an email reply body for a green theme, enter pyEmailReplyBody_Green.
    6. Click Edit next to the Identifier field, enter an identifier name in the following format: EmailReplyBody_<name>, and then click OK.

      For an email reply body template for a green theme, enter EmailReplyBody_Green.
      The new email reply body template label and identifier
      The new email reply body template label and identifier
                                        representing the green theme.
    7. Click Create and open.

      The system saves the email format template as a section rule for the @baseclass class.
  4. Create a new reply template EmailReplyTemplate_<template_name> as a correspondence rule:

    1. In the search field, enter _Cobalt

    2. In the search results, click pyEmailReplyTemplate_Cobalt.

    3. In the top-right corner of the page, click Pick email theme, and then in the Available Templates window, click the new email format template that you created in step 2.e.

      For a green theme, click Green email format.
    4. Click the Footer section in the template, and then in the Footer section on the right, click the HTML tab.

    5. In the text area, edit the copyright information so that it references your company name.

      Modify the copyright string to: Copyright 2020 Acme Inc.
    6. Click the Primary content body section in the template, and then in the Primary content body section on the right, click the HTML tab.

    7. In the text area, change the pyEmailReplyBody_Cobalt string to the name of the rule you created in step 3.f.

      For a green theme, change the string for the name attribute to EmailReplyBody_Green.
      The email reply template for the green theme
      The new email reply template representing the green
                                        theme.
    8. Click the Header Logo section in the template, in the Header Logo section on the right, click the HTML tab, and then in the text area, modify the HTML img tag attributes to reference an image for your company logo.

      If you want to include your own image logos, host them at a publicly available URL rather than including them inline. Many email programs block inline images completely or send them as attachments, by default. As a result, broken email formatting or unnecessary attachments might occur in the system.
    9. Click Save as, and then click Save as.

    10. In the Correspondence Record Configuration section, in the Label field, enter a name for the new email reply template.

      For a new email reply template for a green theme, enter Green email reply template.
    11. Click Edit next to the Identifier field, enter an identifier name in the following format: EmailReplyTemplate_<name>, and then click OK.

      For an email reply template for a green theme, enter EmailReplyTemplate_Green.
      The new email reply template label and identifier
      The new email reply template label and identifier
                                        representing the green theme.
    12. Click Create and open.

      The system saves the email reply template as a correspondence rule for the @baseclass class.
  5. Create a new acknowledgment template EmailAckTemplate_<template_name> as a correspondence rule:

    1. In the search field, enter _Cobalt

    2. In the search results, click pyEmailAckTemplate_Cobalt.

    3. In the top-right corner of the page, click Pick email theme, and then in the Available Templates window, click the new email format template that you created in step 2.e.

      For a green theme, click Green email format.
    4. Click the Header Logo section in the template, in the Header Logo section on the right, click the HTML tab, and then in the text area, modify the HTML img tag attributes to reference an image for your company logo.

    5. Click the Footer section in the template, and then in the Footer section on the right, click the HTML tab.

    6. In the text area, edit the copyright information so that it references your company name.

      Modify the copyright string to: Copyright 2020 Acme Inc.
    7. Click Save as and then Save as.

    8. In the Correspondence Record Configuration section, in the Label field, enter a name for the new email acknowledgment template.

      For a new email acknowledgment template for a green theme, enter Green format acknowledgment email.
    9. Click Edit next to the Identifier field, enter an identifier name in the following format: EmailAckTemplate_<name>, and then click OK.

      For an email acknowledgment template for a green theme, enter EmailAckTemplate_Green.
      The new email acknowledgment template label and identifier
      The new email acknowledgment template label and identifier
                                        representing the green theme.
    10. Click Create and open.

      The system saves the email acknowledgment template as a correspondence rule for the Work- class.
  6. Switch back to App Studio.

After you create the four outbound email template rules representing your company branding and color theme, you can select the template in the Outbound email template list during the configuration of the Email channel. For example, if you create an email outbound template with a green theme, in the list, you can click Green to use it for your email bot. For more information, see Creating an Email channel.
Did you find this content helpful?

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.