Form Intercept

Form Intercept is a tool designed for web page forms that intercepts user input before they submit the form, providing them with a solution to answer their question. You add this tool as a channel in your bot to to streamline the form-filling process and deflect ticket creation by offering users an immediate solution to their queries.

The tool works by analyzing the request and providing relevant solutions or a solution based on the information they provide.

In the example below, a user enters their question / inquiry in the form below:

To Setup Form Intercept:

  1. Navigate to Settings > Channels.

  2. Click the + New Channel button.

  3. Choose the Form Intercept channel option.

  4. Add a Name and the General information.

  5. Add the Prompts and Labels to Buttons.

  6. If necessary, add Domains.

  7. Click the OK button. Navigate to the channel by clicking on the link in the success message or on the channel tile.

  8. Review the Channel Details.

  9. Edit previously defined parameters.

  10. Edit the Policy.

// Some code

You can navigate to the channel by clicking on the link in the success message or on the channel tile.

Copy

{
   "preProcess": {
      "formUpdateFunc": "function(form) {return form;}"
   },
   "process": {
      "queriesBuildFunc": "function(originalForm, preProcessedForm) {var list = new java.util.ArrayList(); list.add(preProcessedForm['title'] + ' ' + preProcessedForm['description']);return list;}"
   },
   "intentThreshold": 0.8,
   "fulfillmentAccept":  [
      "KnowledgeFlow",
      "KB",
      "Casual",
      "Custom",
      "Unknown"
   ],
,
   "handleSameRequestInSession": false
}

In the example above:

  • preProcess: forwards the logic of the “process” to Aisera

  • process: tells Aisers system to analyze the information from Title and Description form fields

  • intentThreshold: 0.8: only answers with a confidence score equal and above 0.8 will be returned

  • fulfillmentAccept: lists all fulfillment types accepted by Form Intercept

    • Flow("Flow")

    • KB("KB")

    • Custom("Custom")

    • Casual("Casual")

    • LiveAgent("LiveAgent")

    • Unknown("Unknown")

    • KnowledgeFlow("KnowledgeFlow")

    • ResolutionNote("ResolutionNote")

    • ServiceCatalog("ServiceCatalog")

    • System("System")

      • System represents any conversation server managed fulfillment

    • handleSameRequestInSession: false: when set to “false”, that means Aisera Form Intercept will not return an answer if the same user submits the same request for the second time within a defined time frame. A “session” parameter is defined in Settings -> Configuration -> Conversation

A Javascript snippet should be included in a host page to use the Form Intercept application. The communication between Form Intercept and the host page is done using window messages.

Form Intercept Integration

The following sections describe the integration tasks and the messages to and from Form Intercept.

Session Variables

The host page should set the following variables in the window.aisera_bot global variable (or window.webchat for backward compatibility):

  • userEmail: User email

  • userFullName: User full name

In addition to the user variables, other session variables could be specified to be used in custom flows.

Example:

Copy

Copy

window.aisera_bot = {
  userEmail: "[email protected]",
  userFullName: "John Smith",
  accountId: "1234"
}

If userEmail is specified in the session variables then it has been set before the snippet that loads Form Intercept, and it cannot be changed later using the aisera.update_session_vars message (described below).

Input Messages

You can request Form Intercept to perform certain operations using the window.postMessage function. In general, the JavaScript looks like the following:

Copy

Copy

let message = {
   type: <message type>,
   // additional fields depending on the message type
};
window.postMessage(JSON.stringify(message), "*");

Following are the supported input messages:

aisera.intercept.request

This message requests a ticket solution. If a solution is found, then the Form Intercept window is displayed.

  • type: aisera.intercept.request

  • fieldValues: The map of the ticket field values

    • For example 1{"title": "...", "description": "...", "category": "..."}

aisera.intercept.close

Can be triggered by the hosting page to close the Form Intercept window.

  • type: Should be aisera.intercept.close

aisera.update_session_vars

The hosting page can update the window.aisera_bot variable at any time, but it needs to send this message to notify Form Intercept.

  • type: Should be aisera.update_session_vars

Output Messages

Form Intercept sends the following messages to the host page to notify about the user actions in the Form Intercept window. In general, the JavaScript to receive the messages looks like the following:

Copy

Copy

window.addEventListener("message", event => {
   let message = JSON.parse(event.data);
   // use message.type etc 
})

Following are the sent messages:

aisera.intercept.ready

This message is sent when Form Intercept is initialized and is ready to process messages. The message fields are:

  • type: aisera.intercept.ready

aisera.intercept.completed

This message is sent when the user closes the Form Intercept window. The message fields are:

  • type: aisera.intercept.completed

  • status: One of the following values:

    • Accepted: The solution is accepted by the user

    • Rejected: The solution is rejected by the user

    • TicketCreated: A ticket is created during the Form Intercept session handling the user request

    • Canceled: The user canceled the window without accepting or rejecting

    • NotHandled: Intercept did not find a solution for the request. In this case the Intercept window is not displayed

  • APIClose: The Form Intercept window is closed using the aisera.intercept.close message

  • Error: An error happened while retrieving the response from the server. In this case the Intercept window is not displayed

Last updated