How can i store the intent name in slot?

Hi,

using slot, and instead of storing the value of the user intent (the text/response entered by the user), I want to store the intent name that corresponds to the intent value of the user.

How to do that?

You’ll probably need a custom action, but the detected intent is stored in the last user sent message [Events], which use can access using the tracker in the SDK.

Ok from Events how can i get the JSON
evt = { “event”: “user”, “text”: “Hey”, “parse_data”: { “intent”: { “name”: “greet”, “confidence”: 0.9 }, “entities”: [] }, “metadata”: {}, }

You’ll need to create an actions.py file, import the tracker and then call it get the intent name before you do whatever else you need to with it. (It sounds like you maybe want to set the slot to be the value of the intent?)

This forum post has a quick example you can modify.

1 Like