Close popover
Piotr Kulig (Piotr Kulig)
Principal Product Architect
Pegasystems Inc.
Piotr Kulig Member since 2014 8 posts
Posted: November 17, 2018
Last activity: December 6, 2018

How to create custom conversational channel input analyzer

Input Text Analyzer should be used for translation when you need to:

  • translate users answer to IVA (MCP) action,
  • change users answer to another text that will be used as a response when finishing assignment.

Text Analyzers work in a chain in specified order. Once the command is resolved, it is not overridden by subsequent analyzer (chain stops).

You can decide if any text analyzer will be applied in context of a case or outside of a case context. This is mapped to pyMode property which can have one of four modes:

  • Case (Apply in context of a case) - analysis will be applied only if current request has work to process,
  • Command (Apply outside of case context) - analysis will be applied only if there is no case to process,
  • None - when none of two options are selected,
  • All - both options selected, analysis will be applied always.

There are some default analyzers set:

  • Exact match - simple analysis which checks if given text matches defined command (response or create case),
  • Pega NLP - advanced analysis which could use a specific Text Analyzer rule, that could be also configured,
  • Pega NLP generated - analysis which gives you possibility to manually configure what text will be matched with which command.

List of Text Analyzers is dynamically generated based on action class inheritance. It is possible to create channel-specific or Pega 7 application level (choosing appropriate ruleset).

There is a possibility to create configuration for Text Analyzers by adding custom section.

Text analyzers are invoked with pyInteractionCase page context, so developer is able to use his own properties from Work-Channel-Interaction-* class.

Manipulation on properties:

  • pyInboundMessage.pyText
  • pyInboundMessage.pyCommand

is suggested, although there is a possibility to change other properties as well.

The least you have to do to add new text analyzer is just creating a class derived from Embed-Channel-TextAnalyzer-.

Step by step guide

  1. Create new abstract Class rule derived from Embed-Channel-TextAnalyzer-:
    • Within your application ruleset if you want to create app-specific action,
    • Within channel's ruleset (i.e. FacebookChannel) to make it visible for all channel instances and make it channel-specific.
  2. Save as pyCaption.TextAnalyzerLabel field value to your Embed-Channel-TextAnalyzer-* class and set proper input Text Analyzers label.
    Available Text Analyzers are visible from Select type dropdown in Channel configuration:
  3. Save as pyAnalyzeInput activity to your Embed-Channel-TextAnalyzer-* class and implement some logic:
    • Primary page for this activity is a page taken from configuration, it contains all properties set within particular configuration of channel which currently is being processed,
    • pyInteractionCase page is available to read the input and set the output.

ProcessingPage is only a parameter name, its value is always set to pyInteractionCase (Work-Channel-Interaction).

Optional steps:

  1. Save as pyTextAnalyzerProperties section to create UI configuration for text analyzer:
    • Embed-Channel-TextAnalyzer-* is a place where you should add all configuration properties,
    • Default values could be placed in pyDefault data transform - remember to call parent-class one.
Pega Intelligent Virtual Assistant Conversational Channels Developer Knowledge Share