My need is: I want to make POST request using Django app and test it on Postman. The call should go to Rasa and the response should come in json format.
Eg:
POST Reguest: “Hi”
Response: “Hello, How may I help you?”
I want this for my response to be integrated with other app.
I found docs and videos around how can I use this via HTML file but I just want conversation to happen at backend.
I also saw this but it does not gives me just response.
Please help…!
Hi @Sajjadmanal , you can try using requests Python module in Django backend, enable REST channel, run Rasa with rasa run --enable-api and then send POST requests from Django backend pointing to your chatbot.
Did you configure the rest: endpoint in the credentials.yml as documented here. Also, make sure you see the endpoint as enabled when you start Rasa. With the --debug option you should see output like this when Rasa starts:
2022-01-19 19:06:52 DEBUG rasa.core.utils - Available web server routes:
/conversations/<conversation_id:path>/messages POST add_message
/webhooks/rest GET custom_webhook_RestInput.health
/webhooks/rest/webhook POST custom_webhook_RestInput.receive
Here’s an example curl command that hits one of my demo bots. You’ll see the json response if you run this.
Please don’t spam tags - there’s a reason multiple tagging isn’t allowed in a post as mentioned in the Code of Conduct:
When you mention others to answer your question, be patient, we do our best to answer questions as quickly as possible, but sometimes we cannot jump on all questions right away. Additionally, the list of mentioned people should not exceed one person per post.
That said, you should provide more pertinent detail on what you have tried, as recommended in “How to ask a great question”, for example:
What’s the URL you are sending your information to?
What does your request look like?
What command did you use to run the server?
Are you using local mode or server mode? If the latter, which deployment method are you using?
What are the relevant configuration points?
What you should generally do is add rest: to your credentials.yml file like here. You then make a POST request to http://localhost:5005/webhooks/rest/webhook with the following raw body:
@ChrisRahme Sorry for the multiple tags. Understood the policy now. Thanks
What’s the URL you are sending your information to? Just want to receive json response of the POST messages.
What does your request look like? Request will be like: {“text”:”Hi”} (need a method to post this request.
What command did you use to run the server? I deployed using docker-compose file and inside docker-compose.override.yml, I mentioned the rasa image
Are you using local mode or server mode? If the latter, which deployment method are you using? Server mode. I am using docker-compose up to run everything
What are the relevant configuration points? Don’t understand this one.