Resources »

Packages »

Chat Bot

Introduction

This package adds a preconfigured bot with some helpful text-based conversational interactions.

Conversational computing1 is a shift toward talking with software using natural language in order to retrieve information and accomplish tasks, rather than pointing and clicking through complex graphical user interfaces.

For instance, these are the steps that have been required to perform a simple search in Cerb (and it’s not much different for most other apps):

  1. Open your web browser
  2. Navigate to a specific URL
  3. Move your mouse to a menu and click it
  4. Click on a link in the menu
  5. Move the cursor to a text box somewhere and click it
  6. Type some text to search for
  7. Add some filters (much more reading, clicking, and typing)
  8. Click a button to start the search
  9. Get some results back (finally)
  10. Sort, subtotal, and/or paginate the results

That’s a very mechanical process – and you probably do it at least a few dozen times per day.

With conversational computing, you could simply say (or type):

find open tickets from Ghoux Games since last Monday

Your chat bot says, “Here’s what I found”, and a worklist instantly popups up with exactly what you’re looking for.

A few years ago that would have still been in the realm of science fiction. Today you probably already converse with virtual personal assistants2 like Alexa, Siri, Cortana, or Google Assistant.

Conversational bots in Cerb provide you with the same conveniences as those assistants, but with the complete freedom to build new behaviors and add new abilities, to integrate with other services, and to take advantage of all the data you already have in Cerb. Our bots know who you and your clients are, contact information and organizational relationships, the conversations you’ve had, open tasks, unread notifications, and so on.

You may have already automated many of your business processes using Cerb bot behaviors. Let’s explore how conversational behaviors can save your workers even more time.

Installing the package

Navigate to Setup » Packages » Import.

Paste the following package into the large text box:



{
  "package": {
    "name": "Chat Bot",
    "cerb_version": "8.0.1",
    "revision": 1,
    "requires": {
      "cerb_version": "8.0.1",
      "plugins": [

      ]
    },
    "configure": {
      "prompts": [

      ],
      "placeholders": [

      ]
    }
  },
  "bots": [
    {
      "uid": "bot_6",
      "name": "Cerb",
      "owner": {
        "context": "cerberusweb.contexts.app",
        "id": 0
      },
      "is_disabled": false,
      "params": {
        "config": null,
        "events": {
          "mode": "all",
          "items": [

          ]
        },
        "actions": {
          "mode": "all",
          "items": [

          ]
        }
      },
      "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAAAXNS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oryULFuO4PHcIzzzwzjb3Icn/uuUNmaYtmGod+zmWcUnvVrjV71nqH1GqpvkzYILUVsD8vHD7MKWh7p7W5FKQ+yrMrjhCN4pqaaiMD1vGv6gzQsRi7Jq+tPRnvLQFnMt2516IuYivPHDxgRnQsEGSFH+BfNRDLEZLNX9lRXXqNVd9qc+rYnh2lBc4qyiuMUSiLfSXKqnCd6MOl2WiFoXH/eCS5zgKH1Fi7RI95TQJXqTqxrMp+zt6rTRmIsm+idXWT9aOtxhyLXUkWrQSrsvu8ahBid+hf+n5Fhfq/dODH+/6nCIkHlRW89hQhKwj8eK9+ipB4UFnBa08RsoLAj/fqpwiJB5UVvPYUISsI/HivfoqQeFBZwWv/H3Xyi8GpnnyhAAAAAElFTkSuQmCC",
      "behaviors": [
        {
          "uid": "behavior_28",
          "title": "Get interactions for worker",
          "is_disabled": false,
          "is_private": false,
          "priority": 1,
          "event": {
            "key": "event.interactions.get.worker",
            "label": "Conversation get interactions for worker",
            "params": {
              "listen_points": "global\r\n"
            }
          },
          "nodes": [
            {
              "type": "switch",
              "title": "Interaction:",
              "status": "live",
              "nodes": [
                {
                  "type": "outcome",
                  "title": "global",
                  "status": "live",
                  "params": {
                    "groups": [
                      {
                        "any": 0,
                        "conditions": [
                          {
                            "condition": "point",
                            "oper": "is",
                            "value": "global"
                          }
                        ]
                      }
                    ]
                  },
                  "nodes": [
                    {
                      "type": "action",
                      "title": "Return interactions",
                      "status": "live",
                      "params": {
                        "actions": [
                          {
                            "action": "return_interaction",
                            "behavior_id": "{{{uid.behavior_29}}}",
                            "name": "Start chat",
                            "interaction": "chat",
                            "interaction_params_json": ""
                          }
                        ]
                      }
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "uid": "behavior_29",
          "title": "Handle interaction with worker",
          "is_disabled": false,
          "is_private": false,
          "priority": 1,
          "event": {
            "key": "event.interaction.chat.worker",
            "label": "Conversation handle interaction with worker"
          },
          "nodes": [
            {
              "type": "switch",
              "title": "Interaction:",
              "status": "live",
              "nodes": [
                {
                  "type": "outcome",
                  "title": "chat",
                  "status": "live",
                  "params": {
                    "groups": [
                      {
                        "any": 0,
                        "conditions": [
                          {
                            "condition": "interaction",
                            "oper": "is",
                            "value": "chat"
                          }
                        ]
                      }
                    ]
                  },
                  "nodes": [
                    {
                      "type": "action",
                      "title": "Run behavior",
                      "status": "live",
                      "params": {
                        "actions": [
                          {
                            "action": "switch_behavior",
                            "return": "0",
                            "behavior_id": "{{{uid.behavior_27}}}",
                            "var": "_behavior"
                          }
                        ]
                      }
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "uid": "behavior_27",
          "title": "Respond to worker chat",
          "is_disabled": false,
          "is_private": false,
          "priority": 1,
          "event": {
            "key": "event.message.chat.worker",
            "label": "Conversation with worker"
          },
          "nodes": [
            {
              "type": "action",
              "title": "Hi!",
              "status": "live",
              "params": {
                "actions": [
                  {
                    "action": "_set_custom_var",
                    "value": "Hi, {{worker_first_name}}. Say **help** for a list of things I can help you with.",
                    "format": "",
                    "is_simulator_only": "0",
                    "var": "say"
                  },
                  {
                    "action": "_run_subroutine",
                    "subroutine": "say()"
                  }
                ]
              }
            },
            {
              "type": "loop",
              "title": "Loop forever",
              "status": "live",
              "params": {
                "foreach_json": "[\"*\"]",
                "as_placeholder": "loops"
              },
              "nodes": [
                {
                  "type": "action",
                  "title": "Prompt",
                  "status": "live",
                  "params": {
                    "actions": [
                      {
                        "action": "prompt_text",
                        "placeholder": "say something, or type 'help'"
                      }
                    ]
                  }
                },
                {
                  "type": "action",
                  "title": "Detect intent from chat message with a classifier",
                  "status": "live",
                  "params": {
                    "actions": [
                      {
                        "action": "core.va.action.classifier_prediction",
                        "classifier_id": "{{{uid.classifier_001}}}",
                        "content": "{{message}}",
                        "object_placeholder": "_prediction"
                      }
                    ]
                  }
                },
                {
                  "type": "switch",
                  "title": "Intent:",
                  "status": "live",
                  "nodes": [
                    {
                      "type": "outcome",
                      "title": "(new conversation)",
                      "status": "live",
                      "params": {
                        "groups": [
                          {
                            "any": 0,
                            "conditions": [
                              {
                                "condition": "message",
                                "oper": "is",
                                "value": ""
                              }
                            ]
                          }
                        ]
                      },
                      "nodes": [
                        {
                          "type": "action",
                          "title": "Respond: Welcome",
                          "status": "live",
                          "params": {
                            "actions": [
                              {
                                "action": "_set_custom_var",
                                "value": "Hi, {{worker_first_name}}. Say **help** for a list of things I can help you with.",
                                "format": "",
                                "is_simulator_only": "0",
                                "var": "say"
                              },
                              {
                                "action": "_run_subroutine",
                                "subroutine": "say()"
                              }
                            ]
                          }
                        }
                      ]
                    },
                    {
                      "type": "outcome",
                      "title": "say.bye",
                      "status": "live",
                      "params": {
                        "groups": [
                          {
                            "any": 0,
                            "conditions": [
                              {
                                "condition": "_custom_script",
                                "tpl": "{{_prediction.classification.name}}",
                                "oper": "is",
                                "value": "say.bye"
                              }
                            ]
                          }
                        ]
                      },
                      "nodes": [
                        {
                          "type": "action",
                          "title": "Respond: Bye!",
                          "status": "live",
                          "params": {
                            "actions": [
                              {
                                "action": "_set_custom_var",
                                "value": "{% set r = [\r\n\"bye \" ~ worker_first_name ~ \"!\",\r\n] %}\r\n{{random(r)}}",
                                "format": "",
                                "is_simulator_only": "0",
                                "var": "say"
                              },
                              {
                                "action": "_run_subroutine",
                                "subroutine": "say()"
                              },
                              {
                                "action": "prompt_wait"
                              }
                            ]
                          }
                        },
                        {
                          "type": "action",
                          "title": "Close window",
                          "status": "live",
                          "params": {
                            "actions": [
                              {
                                "action": "window_close"
                              }
                            ]
                          }
                        }
                      ]
                    },
                    {
                      "type": "outcome",
                      "title": "say.hello",
                      "status": "live",
                      "params": {
                        "groups": [
                          {
                            "any": 0,
                            "conditions": [
                              {
                                "condition": "_custom_script",
                                "tpl": "{{_prediction.classification.name}}",
                                "oper": "is",
                                "value": "say.hello"
                              }
                            ]
                          }
                        ]
                      },
                      "nodes": [
                        {
                          "type": "action",
                          "title": "Respond: Hello!",
                          "status": "live",
                          "params": {
                            "actions": [
                              {
                                "action": "_set_custom_var",
                                "value": "{% set r = [\r\n\"Hello \" ~ worker_first_name,\r\n\"Hi, \" ~ worker_first_name,\r\n\"Hi \" ~ worker_first_name,\r\n\"Howdy \" ~ worker_first_name,\r\n\"Hi there \" ~ worker_first_name,\r\n\"hey \" ~ worker_first_name,\r\n] %}\r\n{{random(r)}}",
                                "format": "",
                                "is_simulator_only": "0",
                                "var": "say"
                              },
                              {
                                "action": "_run_subroutine",
                                "subroutine": "say()"
                              }
                            ]
                          }
                        }
                      ]
                    },
                    {
                      "type": "outcome",
                      "title": "ask.help",
                      "status": "live",
                      "params": {
                        "groups": [
                          {
                            "any": 0,
                            "conditions": [
                              {
                                "condition": "_custom_script",
                                "tpl": "{{_prediction.classification.name}}",
                                "oper": "is",
                                "value": "ask.help"
                              }
                            ]
                          }
                        ]
                      },
                      "nodes": [
                        {
                          "type": "action",
                          "title": "Respond: Help",
                          "status": "live",
                          "params": {
                            "actions": [
                              {
                                "action": "_set_custom_var",
                                "value": "Try one of these: \r\n- help\r\n- hi\r\n- What time is it?\r\n- find my open tickets\r\n- show waiting tickets from Jan 2015 to now\r\n- find Mara's messages from this year\r\n- search my open tasks\r\n- show my new notifications\r\n- bye",
                                "format": "",
                                "is_simulator_only": "0",
                                "var": "say"
                              },
                              {
                                "action": "_run_subroutine",
                                "subroutine": "say()"
                              }
                            ]
                          }
                        }
                      ]
                    },
                    {
                      "type": "outcome",
                      "title": "ask.time",
                      "status": "live",
                      "params": {
                        "groups": [
                          {
                            "any": 0,
                            "conditions": [
                              {
                                "condition": "_custom_script",
                                "tpl": "{{_prediction.classification.name}}",
                                "oper": "is",
                                "value": "ask.time"
                              }
                            ]
                          }
                        ]
                      },
                      "nodes": [
                        {
                          "type": "action",
                          "title": "Respond: The time is...",
                          "status": "live",
                          "params": {
                            "actions": [
                              {
                                "action": "_set_custom_var",
                                "value": "{% set r = [\r\n\"It's \" ~ 'now'|date('g:i a'),\r\n\"The time is \" ~ 'now'|date('g:i a'),\r\n'now'|date('g:i a'),\r\n] %}\r\n{{random(r)}}",
                                "format": "",
                                "is_simulator_only": "0",
                                "var": "say"
                              },
                              {
                                "action": "_run_subroutine",
                                "subroutine": "say()"
                              }
                            ]
                          }
                        }
                      ]
                    },
                    {
                      "type": "outcome",
                      "title": "worklist.search",
                      "status": "live",
                      "params": {
                        "groups": [
                          {
                            "any": 0,
                            "conditions": [
                              {
                                "condition": "_custom_script",
                                "tpl": "{{_prediction.classification.name}}",
                                "oper": "is",
                                "value": "worklist.search"
                              }
                            ]
                          }
                        ]
                      },
                      "nodes": [
                        {
                          "type": "action",
                          "title": "worklistSearch()",
                          "status": "live",
                          "params": {
                            "actions": [
                              {
                                "action": "_run_subroutine",
                                "subroutine": "worklistSearch()"
                              }
                            ]
                          }
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "subroutine",
              "title": "say()",
              "status": "live",
              "nodes": [
                {
                  "type": "action",
                  "title": "Respond in text",
                  "status": "live",
                  "params": {
                    "actions": [
                      {
                        "action": "send_message",
                        "message": "{{say}}",
                        "format": "markdown"
                      }
                    ]
                  }
                }
              ]
            },
            {
              "type": "subroutine",
              "title": "worklistSearch()",
              "status": "live",
              "nodes": [
                {
                  "type": "switch",
                  "title": "Context:",
                  "status": "live",
                  "nodes": [
                    {
                      "type": "outcome",
                      "title": "Tickets",
                      "status": "live",
                      "params": {
                        "groups": [
                          {
                            "any": 0,
                            "conditions": [
                              {
                                "condition": "_custom_script",
                                "tpl": "{{_prediction.params.context|keys|first}}",
                                "oper": "is",
                                "value": "cerberusweb.contexts.ticket"
                              }
                            ]
                          }
                        ]
                      },
                      "nodes": [
                        {
                          "type": "action",
                          "title": "worklistSearchConfirmation()",
                          "status": "live",
                          "params": {
                            "actions": [
                              {
                                "action": "_run_subroutine",
                                "subroutine": "worklistSearchConfirmation()"
                              }
                            ]
                          }
                        },
                        {
                          "type": "action",
                          "title": "Open ticket worklist",
                          "status": "live",
                          "params": {
                            "actions": [
                              {
                                "action": "_set_custom_var",
                                "value": "{% spaceless %}\r\n{% set filters = [] %}\r\n{% set date = _prediction.params.date|first %}\r\n{% set org = _prediction.params.org|first|keys|first %}\r\n{% set owner = _prediction.params.worker|first|keys|first %}\r\n{% set status = _prediction.params.status|keys %}\r\n\r\n{% if owner is not empty %}\r\n  {% set filters = dict_set(filters, '[]', \"owner.id:\" ~ owner) %}\r\n{% endif %}\r\n\r\n{% if status is not empty %}\r\n  {% set filters = dict_set(filters, '[]', \"status:[\" ~ status|join(',') ~ \"]\") %}\r\n{% endif %}\r\n\r\n{% if org is not empty %}\r\n  {% set filters = dict_set(filters, '[]', \"org.id:\" ~ org) %}\r\n{% endif %}\r\n\r\n{% if date is not empty %}\r\n  {% set filters = dict_set(filters, '[]', 'updated:\"' ~ date.date ~ '\"') %}\r\n{% endif %}\r\n\r\n{% endspaceless %}\r\n{{filters|join(' ')}}",
                                "format": "",
                                "is_simulator_only": "0",
                                "var": "_query"
                              },
                              {
                                "action": "worklist_open",
                                "context": "cerberusweb.contexts.ticket",
                                "quick_search": "{{_query}}",
                                "worklist_model": null
                              }
                            ]
                          }
                        }
                      ]
                    },
                    {
                      "type": "outcome",
                      "title": "Messages",
                      "status": "live",
                      "params": {
                        "groups": [
                          {
                            "any": 0,
                            "conditions": [
                              {
                                "condition": "_custom_script",
                                "tpl": "{{_prediction.params.context|keys|first}}",
                                "oper": "is",
                                "value": "cerberusweb.contexts.message"
                              }
                            ]
                          }
                        ]
                      },
                      "nodes": [
                        {
                          "type": "action",
                          "title": "worklistSearchConfirmation()",
                          "status": "live",
                          "params": {
                            "actions": [
                              {
                                "action": "_run_subroutine",
                                "subroutine": "worklistSearchConfirmation()"
                              }
                            ]
                          }
                        },
                        {
                          "type": "action",
                          "title": "Open message worklist",
                          "status": "live",
                          "params": {
                            "actions": [
                              {
                                "action": "_set_custom_var",
                                "value": "{% spaceless %}\r\n{% set filters = [] %}\r\n{% set date = _prediction.params.date|first %}\r\n{% set worker = _prediction.params.worker|first|keys|first %}\r\n{% set status = _prediction.params.status|keys %}\r\n\r\n{% if worker is not empty %}\r\n  {% set filters = dict_set(filters, '[]', \"worker.id:\" ~ worker) %}\r\n{% endif %}\r\n\r\n{% if status is not empty %}\r\n  {% set filters = dict_set(filters, '[]', \"ticket:(status:[\" ~ status|join(',') ~ \"])\") %}\r\n{% endif %}\r\n\r\n{% if date is not empty %}\r\n  {% set filters = dict_set(filters, '[]', 'created:\"' ~ date.date ~ '\"') %}\r\n{% endif %}\r\n\r\n{% endspaceless %}\r\n{{filters|join(' ')}}",
                                "format": "",
                                "is_simulator_only": "0",
                                "var": "_query"
                              },
                              {
                                "action": "worklist_open",
                                "context": "cerberusweb.contexts.message",
                                "quick_search": "{{_query}}",
                                "worklist_model": null
                              }
                            ]
                          }
                        }
                      ]
                    },
                    {
                      "type": "outcome",
                      "title": "Activity Logs",
                      "status": "live",
                      "params": {
                        "groups": [
                          {
                            "any": 0,
                            "conditions": [
                              {
                                "condition": "_custom_script",
                                "tpl": "{{_prediction.params.context|keys|first}}",
                                "oper": "is",
                                "value": "cerberusweb.contexts.activity_log"
                              }
                            ]
                          }
                        ]
                      },
                      "nodes": [
                        {
                          "type": "action",
                          "title": "worklistSearchConfirmation()",
                          "status": "live",
                          "params": {
                            "actions": [
                              {
                                "action": "_run_subroutine",
                                "subroutine": "worklistSearchConfirmation()"
                              }
                            ]
                          }
                        },
                        {
                          "type": "action",
                          "title": "Open activity log worklist",
                          "status": "live",
                          "params": {
                            "actions": [
                              {
                                "action": "_set_custom_var",
                                "value": "{% spaceless %}\r\n{% set filters = [] %}\r\n{% set date = _prediction.params.date|first %}\r\n{% set owner = _prediction.params.worker|first|keys|first %}\r\n\r\n{% if owner is not empty %}\r\n{% set filters = dict_set(filters, '[]', \"actor.worker:(id:\" ~ owner ~ \")\") %}\r\n{% endif %}\r\n\r\n{% if date is not empty %}\r\n  {% set filters = dict_set(filters, '[]', 'created:\"' ~ date.date ~ '\"') %}\r\n{% endif %}\r\n\r\n{% endspaceless %}\r\n{{filters|join(' ')}}",
                                "format": "",
                                "is_simulator_only": "0",
                                "var": "_query"
                              },
                              {
                                "action": "worklist_open",
                                "context": "cerberusweb.contexts.activity_log",
                                "quick_search": "{{_query}}",
                                "worklist_model": null
                              }
                            ]
                          }
                        }
                      ]
                    },
                    {
                      "type": "outcome",
                      "title": "Notifications",
                      "status": "live",
                      "params": {
                        "groups": [
                          {
                            "any": 0,
                            "conditions": [
                              {
                                "condition": "_custom_script",
                                "tpl": "{{_prediction.params.context|keys|first}}",
                                "oper": "is",
                                "value": "cerberusweb.contexts.notification"
                              }
                            ]
                          }
                        ]
                      },
                      "nodes": [
                        {
                          "type": "action",
                          "title": "worklistSearchConfirmation()",
                          "status": "live",
                          "params": {
                            "actions": [
                              {
                                "action": "_run_subroutine",
                                "subroutine": "worklistSearchConfirmation()"
                              }
                            ]
                          }
                        },
                        {
                          "type": "action",
                          "title": "Open notification worklist",
                          "status": "live",
                          "params": {
                            "actions": [
                              {
                                "action": "_set_custom_var",
                                "value": "{% spaceless %}\r\n{% set filters = [] %}\r\n{% set status = _prediction.params.status|keys|first %}\r\n{% set owner = _prediction.params.worker|first|keys|first %}\r\n\r\n{% if owner is not empty %}\r\n{% set filters = dict_set(filters, '[]', \"worker.id:\" ~ owner) %}\r\n{% else %}\r\n{% set filters = dict_set(filters, '[]', \"worker:me\") %}\r\n{% endif %}\r\n\r\n{% if status is not empty and status == 'closed' %}\r\n  {% set filters = dict_set(filters, '[]', \"isRead:1\") %}\r\n{% else %}\r\n  {% set filters = dict_set(filters, '[]', \"isRead:0\") %}\r\n{% endif %}\r\n\r\n{% endspaceless %}\r\n{{filters|join(' ')}}",
                                "format": "",
                                "is_simulator_only": "0",
                                "var": "_query"
                              },
                              {
                                "action": "worklist_open",
                                "context": "cerberusweb.contexts.notification",
                                "quick_search": "{{_query}}",
                                "worklist_model": null
                              }
                            ]
                          }
                        }
                      ]
                    },
                    {
                      "type": "outcome",
                      "title": "Tasks",
                      "status": "live",
                      "params": {
                        "groups": [
                          {
                            "any": 0,
                            "conditions": [
                              {
                                "condition": "_custom_script",
                                "tpl": "{{_prediction.params.context|keys|first}}",
                                "oper": "is",
                                "value": "cerberusweb.contexts.task"
                              }
                            ]
                          }
                        ]
                      },
                      "nodes": [
                        {
                          "type": "action",
                          "title": "worklistSearchConfirmation()",
                          "status": "live",
                          "params": {
                            "actions": [
                              {
                                "action": "_run_subroutine",
                                "subroutine": "worklistSearchConfirmation()"
                              }
                            ]
                          }
                        },
                        {
                          "type": "action",
                          "title": "Open task worklist",
                          "status": "live",
                          "params": {
                            "actions": [
                              {
                                "action": "_set_custom_var",
                                "value": "{% spaceless %}\r\n{% set filters = [] %}\r\n{% set date = _prediction.params.date|first %}\r\n{% set status = _prediction.params.status|keys|first %}\r\n{% set owner = _prediction.params.worker|first|keys|first %}\r\n\r\n{% if owner is not empty %}\r\n{% set filters = dict_set(filters, '[]', \"owner.id:\" ~ owner) %}\r\n{% endif %}\r\n\r\n{% if status is not empty %}\r\n  {% if status == 'closed' %}\r\n  {% set filters = dict_set(filters, '[]', \"isCompleted:1\") %}\r\n  {% else %}\r\n  {% set filters = dict_set(filters, '[]', \"isCompleted:0\") %}\r\n  {% endif %}\r\n{% endif %}\r\n\r\n{% if date is not empty %}\r\n  {% set filters = dict_set(filters, '[]', 'due:\"big bang to ' ~ date.date ~ '\"') %}\r\n{% endif %}\r\n\r\n{% endspaceless %}\r\n{{filters|join(' ')}}",
                                "format": "",
                                "is_simulator_only": "0",
                                "var": "_query"
                              },
                              {
                                "action": "worklist_open",
                                "context": "cerberusweb.contexts.task",
                                "quick_search": "{{_query}}",
                                "worklist_model": null
                              }
                            ]
                          }
                        }
                      ]
                    },
                    {
                      "type": "outcome",
                      "title": "No",
                      "status": "live",
                      "params": {
                        "groups": [
                          {
                            "any": 0,
                            "conditions": [

                            ]
                          }
                        ]
                      },
                      "nodes": [
                        {
                          "type": "action",
                          "title": "Respond: Sorry...",
                          "status": "live",
                          "params": {
                            "actions": [
                              {
                                "action": "_set_custom_var",
                                "value": "{% set r = [\r\n\"Sorry, I'm not sure what you're looking for.\",\r\n\"Sorry, I'm not able to search \" ~ _prediction.params.context|first|default('for that') ~ \" yet.\",\r\n] %}\r\n{{random(r)}}",
                                "format": "",
                                "is_simulator_only": "0",
                                "var": "say"
                              },
                              {
                                "action": "_run_subroutine",
                                "subroutine": "say()"
                              }
                            ]
                          }
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "subroutine",
              "title": "worklistSearchConfirmation()",
              "status": "live",
              "nodes": [
                {
                  "type": "action",
                  "title": "Respond: I've found...",
                  "status": "live",
                  "params": {
                    "actions": [
                      {
                        "action": "_set_custom_var",
                        "value": "{% set r = [\r\n\"Certainly. Here you are.\",\r\n\"Certainly. I've located the records you're looking for.\",\r\n\"I've pulled up that worklist for you.\",\r\n\"I ran that search for you.\",\r\n] %}\r\n{{random(r)}}",
                        "format": "",
                        "is_simulator_only": "0",
                        "var": "say"
                      },
                      {
                        "action": "_run_subroutine",
                        "subroutine": "say()"
                      }
                    ]
                  }
                }
              ]
            }
          ]
        }
      ]
    }
  ],
  "classifiers": [
    {
      "uid": "classifier_001",
      "name": "Detect Intent",
      "owner": {
        "context": "cerberusweb.contexts.bot",
        "id": "{{{uid.bot_6}}}"
      },
      "params": {
      },
      "classes": [
        {
          "uid": "class_001",
          "name": "ask.help",
          "expressions": [
            "Can you help me?",
            "How does this work?",
            "I don't understand",
            "I need help",
            "I'm confused",
            "I'm having trouble",
            "I'm in need of help",
            "I'm lost",
            "What can I say?",
            "You lost me",
            "a little help, please?",
            "what can you do?",
            "what kinds of things can you do?",
            "help"
          ]
        },
        {
          "uid": "class_002",
          "name": "ask.time",
          "expressions": [
            "the time?",
            "time right now?",
            "time",
            "what time is it right now?",
            "what time is it?",
            "what's the clock say?",
            "what's the hour?",
            "what's the time?"
          ]
        },
        {
          "uid": "class_003",
          "name": "say.hello",
          "expressions": [
            "good afternoon",
            "good evening",
            "good morning",
            "hello there",
            "hey there",
            "hi hi",
            "hi there",
            "hi there",
            "how's it going?",
            "what's up?",
            "allo",
            "hallo",
            "hello",
            "hello",
            "hello",
            "hey",
            "heya",
            "heya",
            "heya",
            "heya",
            "hi",
            "hi",
            "hi",
            "hiya",
            "hiya",
            "hola",
            "hola",
            "howdy",
            "howdy",
            "howdy",
            "sup",
            "yo"
          ]
        },
        {
          "uid": "class_004",
          "name": "say.bye",
          "expressions": [
            "adios",
            "bye",
            "bye bye",
            "bye for now",
            "exit",
            "good bye",
            "good night",
            "goodbye",
            "goodnight",
            "later",
            "quit",
            "see ya",
            "see you later"
          ]
        },
        {
          "uid": "class_005",
          "name": "worklist.search",
          "expressions": [
            "show {{worker:Milo}}'s {{status:open}} {{context:tickets}} from {{org:Dobbus}} {{date:since last week}}",
            "show {{worker:Janey}}'s {{status:open}} {{context:tickets}} from {{org:Twinton University}}",
            "show {{worker:Ned}}'s {{status:waiting}} {{context:tickets}}",
            "open {{worker:my}} {{context:notifications}}",
            "display {{worker:my}} {{context:notifications}} for {{date:today}}",
            "what are {{worker:my}} {{context:notifications}}?",
            "list {{worker:my}} {{context:notifications}}",
            "show me {{worker:my}} {{context:notifications}} {{date:since last week}}",
            "show {{worker:my}} {{context:notifications}}",
            "show {{context:notifications}}",
            "show {{context:tickets}} from {{org:Ghoux Games}} {{date:since last month}}",
            "show {{context:messages}} from {{contact:Giada at Fiaflux}} {{date:in the past 30 days}}",
            "open {{context:messages}} from {{org:Ines Lacroix}} {{date:in the past 30 days}}",
            "open {{worker:my}} {{status:unread}} {{context:tasks}}",
            "display {{worker:my}} {{context:tasks}}",
            "what are {{worker:my}} {{context:tasks}} for {{org:Zhang}}?",
            "what are {{worker:my}} {{context:tasks}}?",
            "show {{worker:Kina}}'s {{context:tickets}} {{date:from March 2016}}",
            "show {{worker:Karl}}'s {{context:messages}} {{date:since last Monday}}",
            "show {{worker:Mara}}'s {{status:unread}} {{context:notifications}}",
            "show {{org:Nechist}}'s {{context:tickets}} from {{date:this week}}",
            "list {{worker:my}} {{context:tasks}}",
            "show {{worker:my}} {{context:tasks}}",
            "show {{worker:my}} {{status:incomplete}} {{context:tasks}}",
            "show {{context:tasks}}",
            "show {{date:last month}}'s {{context:tickets}}",
            "show {{date:last week}}'s {{context:tasks}}"
          ]
        }
      ]
    }
  ]
}


You should see the following:

Start a conversation with the bot

Click on the logo in the top left to return to your default page.

You should now see a floating bot icon in the lower right.

Click on it and select Cerb » Start chat:

This starts a conversation with Chat Bot to demonstrate interactions:

Try typing the following messages:

  • hi
  • What time is it?
  • find my open tickets
  • I need help

You’ll notice that the bot is helpful even when you don’t mention “help”:

  • I'm lost and have no idea where to even begin
  • What do I say?
  • What can you do?
  • please tell me what to say

Similarly, you can get the current time with:

  • time
  • the time?
  • right now

If you say hi or time multiple times you’ll get back a few different variations.

Learn how the behavior works

Navigate to Search » Bots and open the card for Cerb.

On the card, click the Behaviors button.

Find the Respond to worker chat behavior and open its card.

You’ll see the decision tree at the bottom of the popup:

Using subroutines

At the top of level of the behavior there are three nodes with bold black labels that end with ():

  • say()
  • worklistSearch()
  • worklistSearchConfirmation()

These are reusable sub-behaviors called subroutines. Subroutines have access to the same dictionary of placeholders as the overall behavior. You can call a subroutine any number of times throughout a behavior by using actions, but a subroutine will never run on its own.

Let’s take a closer look at the say() subroutine. It has one action:

It’s pretty simple. Every time the subroutine is called, it reads the value of the say placeholder and sends it to the worker as a chat message using the Respond with message action. We can send a message back to the worker from anywhere in the behavior by writing some text to the say placeholder and then invoking say().

You may be wondering why we bother to wrap this simple action in a subroutine instead of using it directly every time we want to respond to the worker. That will become very clear by the end of this guide. In short, the say() subroutine allows the bot to also perform other actions every time it sends a message. What you see here is the simplest example to start with.

Determine intent from the chat message

Now we know how to some some text back to a worker using the say() subroutine. It would be a good idea for our bot to figure out what the worker needs to accomplish.

As a listener on the [UI] New chat message from worker event, the bot’s behavior receives a dictionary with placeholders for the current worker and the message that they sent.

The first thing that the behavior does is run an action called Detect intent from chat message with a classifier:

This sends the message placeholder (the worker’s chat message) to the Detect Intent classifier and receives back a prediction that it saves as _prediction. This helps us figure out what the worker is trying to accomplish. We call that their intent.

The _prediction placeholder is a JSON object with this structure:



{
	"text": "I need some help"
	"classifier": {
		"id": 1,
		"name": "Detect Intent"
	},
	"classification": {
		"id": 1,
		"name": "ask.help"
	},
	"confidence": 0.95,
	"params": [
		// Detected entities: dates, times, workers, contacts, etc.
	]
}


React to the intent

Since we’re just interested in the predicted intent right now, we can use the _prediction.classification.name placeholder in a decision.

That’s exactly what the behavior does next. It makes a decision called Intent: with a few possible outcomes:

The (new conversation) outcome is special – it matches when the chat message is empty. This happens when you first open the chat window, and it allows the bot to speak first (letting you know how it can help).

The other outcomes just check the _prediction.classification.name placeholder and compare it to a specific classification name:

The first outcome that matches will continue running and the others will be ignored.

Most of the outcomes respond with some text as an action. For example, here’s say.hello:

This may look a little complicated if you haven’t used placeholder scripting in Cerb’s bots or snippets before, so let’s go through what it’s doing.

Our goal is to break up the monotony of common responses by adding a few variations. In this case, the bot may respond with “hey”, “hi”, “howdy”, etc.

To accomplish that, we’re creating an array of possible responses in the r variable (‘r’ as in responses). That basic syntax is:



{% set r = ['hi','hey','hello'] %}


For readability, we’re putting each array member on a separate line. For the above example, that looks like:



{% set r = [
	'hi',
	'hey',
	'hello'
] %}


For each of those responses we want to address the worker by their first name. We already have a dictionary of worker placeholders, so we can use worker_first_name.

In scripting, a sequence of text is called a string. The process of joining multiple strings together into a single string is called concatenation. The ~ (tilde) operator is used to concatenate strings in scripts.

Now we have an array named r that contains six variations of “hello”; each with the worker’s first name appended to it.

We want to select one of those responses at random and send it to the worker. We do that with the random() function, which accepts an array as an argument. We give it our r responses array.

The output of that script is then saved to a new placeholder named say.

Finally, we call the say() subroutine that we talked about earlier, which takes the say placeholder we just set and sends its contents back to the worker as a chat message.

Next steps

Adding speech

A little earlier we hinted at the future advantages of using the say() subroutine every time the bot sends a message back to the worker. One of those advantages is the ability to also speak the messages that we’re sending. Since all of our messages are routed through a single subroutine it’s surprisingly simple to do.

The Give Cerb bots the power of speech with Amazon Polly guide uses the conversational bot we just created to demonstrate how to add speech to your bot. It’s a great next step.

References

  1. Wikipedia: Chatbot - https://en.wikipedia.org/wiki/Chatbot 

  2. Wikipedia: Intelligent Personal Assistant - https://en.wikipedia.org/wiki/Intelligent_personal_assistant