Need to store values in slot using custom action

In my case i need to store user information in the slots using rest api in the custom action. But slots not stored when i try to interactive with rest api to action server. i have refer all the information from rasa forum and tried many ways but the value didn’t stored in slots.

When i try to interactive with rest api to rasa server its working fine but i want to execute this in action server !!!. please suggest any examples

Requirements:

  • Need to store my front end application user information in the slots. using rest API to action server

  • That slot value need to rendered in bot UI.

here i have attached my files for your reference actions.py (1.3 KB) menu_domain.yml (1.1 KB)

Please help me out.

TIA.

I have do the same thing by custom action. I send a payload with entity from frontend to rasa server and set a custom action to receive it and then parse the entity and store it to slot.

  1. frontend: /set_data{"name", "jack"}
  2. rasa server
  - rule: set data
    steps:
      - intent: set_data
      - action: action_set_data

 3. action server
  class ActionSetData(Action):
    def name(self) -> Text:
        return "action_set_data"

    def run(self, dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
        name = next(tracker.get_latest_entity_values("name"), None)
        return [SlotSet("name", name )]

No need to communicate to action server directly. See the tutorial here:

As the tutorial show, actions server only communicate with rasa server.

1 Like

@ILG2021 Thanks for your help. i saw your reference, Here i need to store user infomation details in slots. so i send the user information details as request in metadata

ex: {

“sender”: “test_user”,

“message”: “Hi there!”,

“metadata”: {“userid”:“001”,“userRole”:“Admin”,“userName”:“Admin”}

}

But i cant able to get this metadata values in custom connectors. its always shows empty or showing like ‘metadata’: {‘model_id’: ‘63318bcabab446b988e1c940aa4feb32’} . can you please refer some document or sample code to store this information in slots. its an big help for me.

TIA.