Hi. I need some guidance on how to reference the message that triggered an intent.
For example, let’s say I have an intent node named CaseSearch, and it’s triggered by someone writing “look up case 4342”. As part of the flow I want to parse out that case number in another node. How would I reference that original message? I’ve tried {{context.intent.CaseSearch}}
as described in the docs here, but it returns an empty string. I’m expecting it to return “look up case 4342”.
Ben,
Can you explain more about what you want to do please?
It is rare to want to reference the original utterance, and it is not good practice for you to perform the parsing of it yourself. The utterance is in the context object but that is a version prior to any kind of correction and normalization, so for you parsing it, you would have to account for a very large number of variations.
If you want to grab that case number, then the CaseSearch flow should have an entity node of type Number, and then you can reference the extracted value through context.entities.entityName
.
Hi Andy. Sure thing. We have a conversation flow for our IT agents to look up ticket information. The way we’ve set it up right now is “look up a case” or something similar triggers the flow, then we prompt the user for the case number with an entity node.
In testing, however, we’ve seen that a lot of people assume that “look up case number 12345” will return the case information immediately. That’s more intuitive for them than “look up case” → prompted to provide case number. Ideally, if we see they provide a case number in the initial utterance, then we parse that out and return the information right away.
That is precisely what an entity will do - it checks the initial utterance (actually all preceding utterances in this conversation) to see if the user has already said an appropriate value.
The entity would only prompt if a value is not found (or you’ve changed the default setting to always prompt)
Got it. Thanks for the clarification Andy. I’ll give that a go.