article by Grant Ronald, December 2019
The problem to solve
When you are using a digital assistant, user input is routed to the most appropriate skill automatically by the digital assistant. But what if you want to pre-process the user input? For example, you might find extraneous punctuation such as an exclamation mark which impacts the intent resolution so you want to strip it out before the System.Intent. Or maybe you want to force a particular behavior by altering or augmenting the original user input in order to slightly skew the intent resolution.
The solution
The solution is actually quite simple but involves knowing a particular system property which holds the user input: "${system.message.messagePayload.text}" which is the user input which the digital assistant is using to route the request.
Here you can see that the skill firstly reads the value of the message payload to get the user input, performs the appropriate processing (in this case removing the trailing exclamation mark) then uses the sourceVariable property as the mechanism to pass the processed user input into the System.Intent.
Note: It is worth noting that whilst this is a useful and potentially common use case, it does allow you to change the user input in such a way that that utterance should never have been routed to that skill in the first place. So use with some caution.
Related Content
Tech Exchange Quick-Tip: Pre-empting User Choices For A Better User Experience
TechExchange Quick-Tip: Four Options You Have to Extract Information From User Messages
TechExchange: All 2-Minutes Oracle Digital Assistant Tech Tip Videos on YouTube