Creating a Virtual Assistant

Virtual Assistants

With a virtual assistant, it is possible to talk to several bots in one conversation, to create pipeline steps to allow a variety of features such as redaction and translation, among other conversational features.

In this section, we will go through the process of creating a simple virtual assistant with two bots.

Set up your bots

The first step is to create two bots, each one with a specific job. In this example, the first bot is a general information bot with a DialogFlow worker, and the second bot is for doing a long process, such as a money transfer, using a Classic Flow Worker. DialogFlow, Lex, and X86 workers are supported for VA interaction.

Create your virtual assistant

To start creating VAs, there are two prerequisites:

  • Your organization must have VAs enabled. Contact your ServisBOT representative to enable this.
  • Your user in the organization must have the master bot builder role to see and configure VAs.

To create a VA, you will need a VA definition saved in a JSON file, such as VA.json below:

{
  "Name" : "MoneyTransferVa",
  "Description": "A virtual assistant to aid monetary transfers",
  "DefaultBotId": "info-bot",
  "Bots" : [
    {
      "Type": "BOTARMY",
      "Id": "info-bot",
      "Properties": {
        "Name": "info-bot"
      }
    },
    {
      "Type": "HELIUM",
      "Id": "transfer-bot",
      "Properties": {
        "Name": "transfer-bot"
      }
    }
  ],
  "NluEngines": [
    {
      "Id": "mock",
      "Type": "MOCK",
      "Properties": {
        "Handlers": [
          {
            "Regex": "help|info",
            "Actions": [
              {
                "Type": "ASSIGN_BOT",
                "Properties": {
                  "BotId": "info-bot"
                }
              }
            ]
          },
          {
            "Regex": "money|send( money)?|transfer( money)?",
            "Actions": [
              {
                "Type": "ASSIGN_BOT",
                "Properties": {
                  "BotId": "transfer-bot"
                }
              }
            ]
          }
        ]
      }
    }
  ],
  "IngressPipeline": [
    {
      "Id": "CreditCardRedact",
      "Type": "REGEX_REDACT",
      "Properties": {
        "Regex": "(?:5[1-5][0-9]{2}|222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}"
      }
    }
  ],  
  "EgressPipeline": [],  
  "Events": {
    "@SessionStart": [
      {
        "Id": "sessionStartMessage",
        "Type": "SEND_MESSAGE",
        "Properties": {
          "Message": "Welcome to the transfer VA. Type 'help' for more info about what I do, or 'transfer' to make a monetary transfer."
        }
      }
    ]
  },
  "Persona": "ReportBOT",
  "Tags": []  
}
  • Name: The name of the VA (Required)
  • Description: A description of the VA (Optional)
  • DefaultBotId: The ID of a bot to assign to the VA by default (Optional)
  • Bots: An array of bots that the VA manages (Required, minimum of 1 bot)
    • Type: The Bot type. Supported types are MOCK, BOTARMY, RASA, and HELIUM. (Required)
    • Id: A custom ID which is used to refer to this bot elsewhere in the VA config (Required)
    • Properties: Other properties (Required)
    • Name: The name of the bot being referred to.
  • NluEngines: The NLU engine used to parse user input, allowing for natural language recognition. (Required)
    • Id: A custom ID used to refer to this NLU engine elsewhere in the VA config. (Required)
    • Type: The NLU engine type. Supported types are MOCK and RASA. (Required)
    • Handlers: An array of different actions triggered by regex (Required)
  • IngressPipeline: A series of steps that occur when a message is sent to the VA. The steps here can include redaction for masking sensitive information, language translation, and more. (Optional)
  • EgressPipeline: The same as the IngressPipeline, just with messages that are sent out from the VA. (Optional)
  • Events: An array of events that trigger actions. (Optional) Supported events are:
    • @SessionStart: Triggers at the beginning of a conversation.
    • @MissedInput: Triggers when an incoming event cannot be understood and/or acted upon by a Bot or NLU engine.
    • @Exception: Triggers when a transient error occurs.
  • Persona: Sets the appearance of the bot in Portal (Optional)
  • Tags: Arbitrary tags for categorizing your VA. (Optional)

The VA is created by running sb-cli va create VA.json. Once created, you will see it appear in the Virtual Assistants section of Portal and when running sb-cli va list.

created-va

created-va-pipelines

Set up an endpoint for the VA

With the VA created, you will need to be create an endpoint before the VA can be interacted with via the ServisBOT messenger. This can be done through the endpoints section of Portal. The most important things to note are the target type, which should be set to Virtual Assistant as well as Target Reference, which should be the name of the VA.

va-endpoint

Testing your VA

Once created, the VA can be tested on lightning by clicking the test button near the bottom.

VAs are not supported in Lightning V1. When testing, make sure that Lightning V2 is being used.

va-conversation

From the image above, we can see the @SessionStart being triggered, sending a welcome message. Typing ‘help’ assigns the helper bot to answer any general questions. Typing ‘send money’ reassigns the bot to the transfer bot, beginning a monetary transfer.