2

do I need to define the key that gets updated with the new asnwer from the user, or do I set the condition that I need to be satisfied to proceed? The explainer on the right says both: Describe the context keys that will be updated by your action and if you need more than one condition to be met, you can use '&&' etc etc..

Can anyone explain this feature functionality better? thanks

BTMKR
  • 21
  • 1

1 Answers1

0

I also had confusions in understanding the context part, but later figured it out. Let me try to explain the way I understood.

In a story you want some actions to be executed and also you want your actions to return some result or rather I would say, you want some variables to be set with some value within your action that you will use in the next step of your conversation in wit.ai. Those variables can be defined in wit.ai as context keys.

Below is an example:

I have a credit card and I want to report lost card using bot. I say I lost my credit card and give the bot required information for it to fetch my card details, then it will call an action BlockCard. As a result of execution, I need the name, last 4 digits of the card and reference number for the raised complaint. These 3 variables need to be filled in while the action BlockCard runs. These are declared in wit.ai as context keys with '&&'. I would use these variables in the further conversation.

Note: You need to make sure that the name of context keys and name of the actions declared in wit.ai and the names used in your code are same.

Have a look at wit story:

https://wit.ai/Nayana-Manchi/CreditCardApp/stories/f7d77d9e-e993-428f-a75e-2e86f0e73cb3


Nayana M
  • 65
  • 7
  • I hope this helps. Please rate if its useful. – Nayana M Oct 06 '16 at 10:43
  • Hey, the explanation is useful but could you maybe explain (even in sudo code) how the context is updated locally and sent back? The wit site says the context is updated locally only – Martin O Leary Jan 07 '17 at 12:58