How to get user id from Rasa HTTP API and use it for search in database

Hello everyone, I am building a rasa chatbot and am integrating it into an android app. So, I have called the link localhost:5005/webhooks/rest/webhook with { “sender”: “1234”, “message”: “اهلا” } and respond correctly but I want to use sender [1234] on further operations in rasa like searching in the database for the information of user 1234 so I can response correctly.

It’s on tracker.sender_id. Here’s an example getting it on action_session_start.

class ActionSessionStart(Action):
    def name(self) -> Text:
        return "action_session_start"

    async def run(
        self, dispatcher, tracker: Tracker, domain: Dict[Text, Any]
    ) -> List[Dict[Text, Any]]:
        metadata = tracker.get_slot("session_started_metadata")
        sender = tracker.sender_id
1 Like