How do i only get integer value from customData?

Hello,

I’m able to send data from my website to Rasa server using customData using customData:{“userID”:“id_no”}. But my issue is i’m getting in the form of {“userID”:“44”} i only need integer value so i can use it in my API. Also can anyone tell me how do i pass the customData value directly to api written in external file.

class ActionCheckLeaveBalance(Action):

def name(self) -> Text:
    return "action_leave_api"   

def run(self, dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
                
    metadata=extract_metadata_from_tracker(tracker)
    hello = metadata

return []

Im able to extract customData from metadata variable. I need integer value and also how to pass it to my api body written externally.

But my issue is i’m getting in the form of {“userID”:“44”} i only need integer value so i can use it in my API.

Do you mean how to get the 44 from {“userID”:“44”}? That would be


user_id = {“userID”:“44”}.get("userID")
if user_id:
  user_id_as_int = int(user_id)

Also can anyone tell me how do i pass the customData value directly to api written in external file.

Can you please explain a bit more what you’re doing? Do you want to know how to an API request? And what do you mean by external file?

Hey @Tobias_Wochinger. I was able to figure the solution myself. Thanks for the heads up.

Hey @Tobias_Wochinger. I want to run the core models with --enable-api command on a linux server on a VM. I installed everything required and am able to run rasa run actions and also rasa run -m models --enable-api --cors “*” but im unable to see the webchat on my website. Previously. it ran fine on local machine. Now i want to make the rasa server run on a remote server. How do i achieve this?

@shanrock Could please describe how you deployed Rasa Open Source and how your webchat is connected to it?