Get the last slot name

Hello community ! Is there a method in the Tracker class which returns the last slot name (not the value) the bot asked for ?

Thanks.

If you are referring to forms, then you can actually look for “requested_slot” value in the tracker.

Thank you for your reply, but that is used to get the slot’s value right ? I want the last slot’s name.

Requested slot will actually store the slot name that Chatbot is going to ask not the slot value.

Can you please specify the full instruction ? I don’t think we’re talking about the same thing.

Hey @forwitai, you can get the all sort of information from the tracker.

In your custom actions, for the variable tracker several keys are associated with it if you iterate. One such key is events. Inside the events, you will have name of the event. You need to take the event for which the name is slot.

Sample structure of tracker:

{ “sender_id”: “a4ed14118aa44d8d8cd99f0e76c0a77f”, “slots”: { “application”: null, “category”: “chitchat” }, “latest_message”: { “intent”: {}, “entities”: [], “text”: null, “message_id”: null, “metadata”: {} }, “latest_event_time”: null, “followup_action”: “action_listen”, “paused”: false, “events”: [

{ “event”: “action”, “timestamp”: 1598940230.4783618, “name”: “action_session_start”, “policy”: null, “confidence”: null },

  {
    "event": "session_started",
    "timestamp": 1598940230.478369
  },


  {
    "event": "slot",
    "timestamp": 1598940250.5231595,
    "name": "category",
    "value": "chitchat"
  },

], “latest_input_channel”: null, “active_form”: {}, “latest_action_name”: null },

So, that’s how to.do it. Sorry if you are not looking for this. But I am pretty much sure that whatever you require can be achieved using tracker and custom actions.

All right, thank you very much !