How to collect multiple responses from RASA through REST API

Hi, I have implemented a custom web page where I communicate with RASA through the REST API.

I send a POST request with the message of the user and generally get a response back like

User: Hi Bot: Hi, what is your email address?

In the next message I respond with my email address and in return the flow that I have set up the flow of the chat as follows:

User: name@gmail.com Bot: Okay, i have detected your name is Name Bot: What can i do for you Name?

This is how the response is supposed to be but i only get the first message. How do I make my front-end listen to multiple responses from rasa that may take a second between each response?

url = "http://localhost:5005/webhooks/rest/webhook"
payload = '{\"sender\":\"'+sender_id+'\",\"message\":\"'+text+'\"}'
headers = {'Content-Type': 'text/plain'}
response = requests.request("POST", url, headers=headers, data=payload)

This is my code for sending a POST request.

Anyone know any solutions?

Hi @iluko_10 could you please share your story for the same scenario

As far as I can tell you can’t since REST api is a single way connection and listens to only the first response.

You might want to try SocketIO integration for your website that way any number of messages responded back by rasa will be communicated to your page

Thanks that’s what I am using currently.