Thomas Lau • almost 9 years ago
How to keep intent value across multiple intents?
I would like to build a bot with multiple related intents.
e.g. product inquiry an product ordering
Assume that a customer asks about a product detail and then orders the product.
Both actions have to retrieve replies from Lambda.
So, I would separate each action in a individual intent.
I cannot find a way to keep the value (e.g. Product ID) from one intent to another intent.
In this case, customer has input a product name/ID as intent value in the part of inquiry.
However, I don't want the customer to enter the product ID/name again when customer are talking with the bot from first intent (inquiry) to second intent (ordering).
Would anyone advise the way to keep those intent values across multiple intents?
*** In Api.ai, there is a mechanism of "context" to keep those values.
Comments are closed.

1 comment
Angela R Wang • almost 9 years ago
hi,
You can use the "sessionAttributes" field to pass context between intents.
In your lambda function, you can return a "sessionAttributes" field that contains key value pairs (See the lambda input and response format documentation here: http://docs.aws.amazon.com/lex/latest/dg/lambda-input-response-format.html)
This page also explains in more detail on how this works: http://docs.aws.amazon.com/lex/latest/dg/context-mgmt.html it also links to an example bot that demonstrate this http://docs.aws.amazon.com/lex/latest/dg/ex-book-trip.html