# Response

# What

# What is response templates?

Response template is the structure built in the Platform to generate a response built in natural language with slots/variables that are dynamically assigned at response time.

Each competency type uses a different set of response templates and variables that are used for response generation.

informational confirmational response templates

# Competency

Response Templates Variables
competency_name: The default template used for all responses. Each slot is turned into a variable with the same name which you can use directly when writing responses. By default, the value of the variable is the list of tokens that have been extracted via SVP.

# Global Response Templates

The Conversation Guidance features, Must-Complete and Incomplete Reminder have their own, special, response templates. These are at the version/personality level instead of at the competency level. They appear at the top of the list of templates for any given personality. They can be edited, imported, and exported like other templates.

# What response editors are available in the Platform?

In the Clinc AI Platform, there are two editors you can utilize to generate response:

  • Jinja editor
  • Python editor

# Jinja Editor

Jinja (opens new window) is a templating engine that offers a powerful set of filters and control flow structures. Jinja allows you to combine a template with a set of variables to generate a response.

# Python Editor

Python editor allows you to edit response in Python 2.7.

# What is Personalities?

A personality is a set of response templates that cover all the competencies of an AI version with which you can configure for the experience your use case provides. Some sample use cases for creating different personalities can be: foreign languages, user demographic, application version, changes to sync with the business logic, etc.

A device is a mapping between personality and integration with which unique keywords are associated so when the keywords are present in the payload the Platform knows which personality to point to.

# How

How to edit response?

How to incorporate rich response fragments?

How to save Jinja code as a macro?

How to test response?

How to configure Personalities?

# How to edit response?

There are two ways you can access response editor:

  1. Click a competency in the competency sidebar, and then click DEFAULT under the RESPONSES header.

state to response

Or

  1. Click Personalities in the competency sidebar on the left. Then you will see a list of all the personalities you configured for your competency, click View Templates to reveal the response template list for all competencies you have in this AI version.

view templates

Click editto open the response editor.

personalities to response

# Jinja

+ Insert Snippet allows you to add variables, for loops and if statement into the response template quickly.

response editor

# How to incorporate rich response fragments (RRF)?

Rich Responses are a way to build a response filled with device schema, such as Facebook Messenger "Quick Reply" buttons.

In order to use Rich Responses, you'll need to create a Response Fragment. There are two ways you can go about creating a fragment:

In the dropdown menu of + Insert Fragment, select + New.

insert fragment

or

In the Fragment Editor select + New.

fragment editor

Note: Within the fragment, you can add elements like Phone number, Carousel, Link, Quick Reply and Text Response or insert existing fragment.

fragments

Element Explanation
Phone number The phone number is a way to wrap a phone number in a standard format that is presentable and reusable.
Carousel The carousel fragment provides the functionality of allow for an image and some small amount of text presented and the user to scroll between several slides. Providing a slide carousel type of experience.
Link The link element works similarly to the phone number in that it provides a visual way to represent a URI. In most implementations this would be clickable and open a webpage to access the URI. You can configure the URI and the text presented to the user.
Quick reply The quick reply is a button element that presents a visual way for a user to provide a pre built responses, such as yes or no.
Text response The text response is a way of wrapping a response or portion of a response in a UI element. This will be helpful if you find that you are using the same text component repeatedly.

Here's a sample payload for each type of elements:

Standard Format

Sample Payload

// Phone number
{
    "type": "list",
    "list_type": "vertical",
    "children": [
        {
          "type": "link",
          "link_type": "phone",
          "link": "tel:1-800-123-4567",
          "text": "1-800-123-4567"
        }
    ]
}

// Link
{
    "type": "list",
    "list_type": "vertical",
    "children": [
        {
          "type": "link",
          "link_type": "web",
          "link": "https://clinc.com",
          "text": "Visit Clinc.com"
        }
    ]
}

// Quick Reply
{
    "type": "list",
    "list_type": "vertical",
    "children": [
        {
          "type": "link",
          "link_type": "quick_reply",
          "link": "qr:clinc?query=Quick%20Reply",
          "text": "Quick Reply"
        }
    ]
}

// Text Response
{
    "type": "list",
    "list_type": "vertical",
    "children": [
        {
          "type": "text",
          "text_type": "normal",
          "text": "Text Response"
        }
    ]
}

// Horizontal Carousel
{
    "type": "list",
    "list_type": "vertical",
    "children": [
        {
          "type": "list",
          "list_type": "horizontal",
          "children": [
              {
                "type": "list",
                "list_type": "vertical",
                "children": [
                    {
                      "type": "image",
                      "image": "https://clinc.com/wp-content/themes/clinc/static/img/logo.png",
                      "text": "Clinc Logo"
                    },
                    {
                      "type": "text",
                      "text_type": "title",
                      "text": "Title"
                    },
                    {
                      "type": "text",
                      "text_type": "subtitle",
                      "text": "Subtitle"
                    },
                    {
                      "type": "link",
                      "link_type": "web",
                      "link": "https://clinc.com",
                      "text": "Clinc.com"
                    }
                 ]
              }
           ]
        }
    ]
}

// Vertical List / Carousel Card
{
    "type": "list",
    "list_type": "vertical",
    "children": [
        {
          "type": "list",
          "list_type": "vertical",
          "children": [
              {
                "type": "image",
                "image": "https://clinc.com/wp-content/themes/clinc/static/img/logo.png",
                "text": "Clinc Logo"
              },
              {
                "type": "text",
                "text_type": "title",
                "text": "Title"
              },
              {
                "type": "text",
                "text_type": "subtitle",
                "text": "Subtitle"
              },
              {
                "type": "link",
                "link_type": "web",
                "link": "https://clinc.com",
                "text": "Clinc.com"
              }
          ]
       }
    ]
}               

Messenger Format (Used for Facebook Messenger)

Sample Payload

// Phone number
[
  {
    "buttons": [
        {
          "type": "phone_number",
          "primaryText": "1-800-123-4567",
          "payload": "+18001234567"
        }
      ]
   }
]

// Link
[
  {
    "buttons": [
        {
          "type": "web_url",
          "primaryText": "Visit Clinc.com",
          "payload": "https://clinc.com"
        }
      ]
   }
]

// Quick Reply
[
  {
    "text": {
        "primaryText": "",
        "quickReplies": [
              {
                "primaryText": "Quick Reply",
                "payload": "Quick Reply"
              },
              {
                "primaryText": "Quick Reply",
                "payload": "Quick Reply"
              },
              {
                "primaryText": "Quick Reply",
                "payload": "Quick Reply"
              }
           ]
        }
    }
]

// Text Response
[
  {
    "text": {
        "primaryText": "Text Response"
    }
  }
]

// Horizontal Carousel
[
  {
    "responseList": {
        "type": "carousel",
        "elements": [
            {
              "image": "https://clinc.com/wp-content/themes/clinc/static/img/logo.png",
              "primaryText": "Title",
              "secondaryText": "Subtitle",
              "actions": [
                    {
                      "type": "button",
                      "elements": [{
                      "type": "web_url",
                      "primaryText": "Clinc.com",
                      "payload": "https://clinc.com"
                    }
                  ]
                }
              ]
            },
            {
              "image": "https://clinc.com/wp-content/themes/clinc/static/img/logo.png",
              "primaryText": "Title",
              "secondaryText": "Subtitle",
              "actions": [
                    {
                      "type": "button",
                      "elements": [{
                      "type": "web_url",
                      "primaryText": "Clinc.com",
                      "payload": "https://clinc.com"
                    }
                  ]
                }
              ]
           }
        ]
     }
  }
]

// Vertical List / Carousel Card
[
  {
    "text": {
        "primaryText": "Title"
      }
  },
  {
    "text": {
        "primaryText": "Subtitle"
      }
  },
  {
    "buttons": [
        {
          "type": "web_url",
          "primaryText": "Clinc.com",
          "payload": "https://clinc.com"
        }
      ]
   }
]

Each element allows you to edit, move, and delete by clicking the element itself.

edit elements

Insert fragments into any response template simply by wrapping the name of the fragment with RF. Templates rendering Rich Response fragments must only have the RF tag in order to render.

RF(hello)

Apply Fragment

Elements will then render inline with the response.

# How to save Jinja code as a macro?

If you have a Jinja response that you use repeatedly, you can create a macro for quick insert. You can create a macro inside the fragment editor.

To create a macro fragment:

  1. In the Fragment Editor select + New.

fragment editor

  1. Give your new macro fragment a name.
  2. Click +Add Element and select Jinja Code Snippet.

jinja code snippet

  1. Click on the fragment, in the menu popped up, select Edit.

edit jinja fragment

  1. Put or paste in the code, click Save then you are good to go!

preview macro fragment

To reuse the fragment, it's the same as inserting a rich response fragment simply wrapping the name of the fragment with RF.

# How to test response?

The Platform provides a tool for you to test if the response is rendered properly without having to come up a series of queries that fits the all the requirements. To test response:

  1. Toggle the switch next to Test Response at the top of the editor.
  2. Click + Add Test Slot Data.
  3. Choose a slot type that you wish to test, and add values to it. Then hit enter.
  4. Now you can already see the response changes dynamically with your test slot data.

test response

# How to configure Personalities?

To get to the Personalities page, click Personalities in your competency sidebar. On the Personalities page, you can:

  • Create new personalities by click on add personNew Personality. In the modal popped up,

create personality

  1. Give your Personality a name. It can be tailoring different age group such as millennials, baby boomers etc. Or name it by devices that the Personality is deployed to.
  2. Clone from default is similar to create a new AI version, it allows you to work on a new sets of responses based on an existing personality.
  3. Select device(s) with which you would like the personality to be associated.
  4. Advance settings: these settings are designed specifically for financial competencies.
  • You can also edit settings for each personality. The configuration is similar to creating a new one.


Last updated: 01/08/2021