Natural Language Understanding (NLU)

Purpose: This is a feature to ask questions of a client or applicant and interpret natural language responses. This allows for asking the questions via SMS and Voice in addition to the standard web interface. 


Cost: $6,250 one time costs to enable and then $50/month. This feature is currently in Beta. 

This operates by having a Guided Navigation dialogue control the questions asked. That dialogue is then linked to Twilio to send the appropriate text messages and interpret the responses. 

NLU requires the SMS Module to operate. Sending NLU requests on existing cases requires the Workflows module


Creating your Guided Navigation Dialogue

NLU operates through a Guided Navigation dialogue. Please note that not all blocks are supported, Custom Lookups are not supported, and only some lookups are currently supported. 

Field types supported by the NLU:

For dates, LegalServer uses the “Duckling” tool. Their documentation provides a wealth of examples that can be understood. 

For lookups, LegalServer first tries to match the hard coded responses in the lookup. If nothing matches, then it tries to classify the text to values that match either the lookup or the LSIndex value for the lookup. 

Additionally, any field marked as Confidential is not available in the NLU features. SMS is inherently insecure, so fields with sensitive information should not be included or requested. 

When creating your Guided Navigation Dialogue, there is a new field on each element you add to the segments to indicate if it should be included in the available Channels: 

The channels are whether this element is included in the given NLU channel. Web is the standard User Interface. SMS and Voice are for the NLU channels themselves. 

Best practice is to include a concluding instruction thanking the client for participating and indicating that the process is complete. 

WARNING: Your Guided Navigation should not be available for end users in the UI to review. Please use a separate dialogue for that. If you use the same dialogue, the state of the dialogue will get confused and result in questions being asked out of order or not being asked at all. 

Creating your Process

When adding the Dialogue to a form, it needs to be added to an External form (Intake or Auxiliary as desired). That form then needs to be added to an External process. Once the process is created, be sure to set the process as available via the Guided Navigation API.

An External Intake is needed for a new applicant. An External Auxiliary process is needed to reach out to an existing client. 

Connecting your Process to Twilio

Each type of NLU process (Intake and Auxiliary/Workflows) needs to be connected to a separate Twilio phone number. This can happen on the SMS & Telephony Admin page. Both these processes and the standard SMS integration all use different webhooks with LegalServer. If no unique phone number is established, then the standard Twilio Phone Number will be used. If the webhook identified in Twilio isn’t set appropriately, then this will not work.

To get the webhook url to link to Twilio, you’ll need to go to Admin -> NLU Intake Settings. Once you Select the External Aux process, you will get specific URLs to use with Twilio. 

Each process has its own default link, although the specified process is a backup only. Note that NLU Intake, NLU Auxiliary, and Standard LS SMS all use different webhooks. Only one phone number needs to be connected to each endpoint in Twilio. The NLU links include a number of default parameters `?channel=sms&pid=12354&h=2345`. These are defaults in case something is missing. They will be ignored if a different process was initiated by workflows.  

Then Login to Twilio and Manage your phone numbers. When you find the phone number you want to associate with this particular process, you’ll paste the new url to process into the settings:

If you are connecting voice processing, it should be via the Voice section. 

Triggering the NLU Process from a Workflow

When setting up the NLU Process to trigger from a Workflow, you can set the triggers for the workflow as standard. The key aspect for the NLU Process is to select an Action Step of Send NLU Process. An example follows: 

Workflows triggering on Time Since Event can be configured to have a minimum start time for the day to prevent the client from being woken up by the NLU messages. 

Administrative Details

Each destination number should only have one texting interaction active at a time. LegalServer by default allows for up to 7 days to finish the interaction. That setting can be changed on the backend by LegalServer in full day increments. 

You can send the message “start over” to clear all states for the session. This is only for testing and should not be used by end users. This may only work on the Intake NLU interactions. 

Sending the text “go back” should cause an attempt to return to the previous interaction (the most recently asked field, for example). This may only work on the Intake NLU interactions.  

Your site will have NLU Logs available in the Admin tab. These allow you to see information about what was sent or said to the applicant/client and their response. If their response was not parsed properly, you have the option to correct the learning model being used. 

Testing Suggestion

When testing the workflow features, we recommend using a Field Value Change on a boolean or lookup to trigger the SMS messages to send. This way you can easily test the text message interaction. When putting it into production, you may want a much more complicated trigger, but something simple to test the SMS dialogue with is strongly recommended. 

Known Bugs: 

When testing your text interaction, if the questions come out of order, edit and re-save the guided navigation dialogue to ensure that all the questions have unique UUIDs. This is relevant to dialogues created before January 15, 2023 on Live Sites.