DEV Community

Cover image for RASA - REST API


petr7555 profile image Petr Janik ・2 min read

So far, we have been interacting with the chatbot in the terminal.

In this chapter, we will look at how we can send messages to the chatbot via REST API.

Add the following to the credentials.yml. If you created your project using rasa init, it should be already there and you don't need to do anything.

  # you don't need to provide anything here - this channel doesn't
  # require any credentials
Enter fullscreen mode Exit fullscreen mode

To send a request, I will use Postman's desktop app. You can now run Postman also in the browser without installing the app. Or you can use You can of course use terminal interface like curl as well.

Let's start the server by running rasa run.
The server is now running on http://localhost:5005/.

Server is running

Now, send a POST request to http://localhost:5005/webhooks/rest/webhook in the following format:

  "sender": "test_user",
  "message": "Hi there!",
Enter fullscreen mode Exit fullscreen mode

The response will be a JSON body of chatbot responses, for example:

        "recipient_id": "test_user",
        "text": "Hey! How are you?"
Enter fullscreen mode Exit fullscreen mode

Here's how it looks in Postman:

You can learn more about Rasa's REST API in the documentation.

In the next chapter, we will look at Rasa X, a tool for Conversation-Driven Development.

Repository for this tutorial:

You can checkout the state of the repository at the end of this tutorial by running:

git clone --branch 07-rest-api
Enter fullscreen mode Exit fullscreen mode

Discussion (0)

Forem Open with the Forem app