REST API query from chat bot built via RASA to any server

Viewed 688

I am planning to build a chatbot via RASA. My goal is to build a chat bot which does following.

  1. Get query from user
  2. Convert it to json/html/xml query based on query.
  3. POST to a server(supports REST API interface which understand json/xml queries)
  4. GET answer from server and reply to user.

I heard that we have to write a script which does this ssh and get data - as a custom action. But I would like to know whether we can do POST and GET via REST APIs. Is this possible via chatbot implemented via RASA? If so, please let me know the pointers.

Thanks.

1 Answers

To make requests to external apis you will need to implement a custom action. You can take a look at a simple chatbot I implemented with Rasa here: https://github.com/carlad/jackson

You'll see in my actions/actions.py file I implement a custom action to submit a query to the external API. In my case it's a GET request, but you can implement POST requests too.

My action then displays part of the response payload to the user in the chat conversation.

Related