# Get Rasa chatbot response from APIs

**URL:** <https://forum.rasa.com/t/get-rasa-chatbot-response-from-apis/51106>\
**Category:** Rasa Open Source\
**Created:** [February 3, 2022, 1:58pm UTC](https://forum.rasa.com/t/get-rasa-chatbot-response-from-apis/51106 "2022-02-03T13:58:02Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sajjadmanal](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/sajjadmanal/32/18330_2.png) [@Sajjadmanal](https://forum.rasa.com/u/Sajjadmanal)\
**Post date:** [February 3, 2022, 1:58pm UTC](https://forum.rasa.com/t/get-rasa-chatbot-response-from-apis/51106/1 "2022-02-03T13:58:02Z")

</div>

Hi, I am using Rasa 2.x

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](https://rasa.com/docs/rasa/http-api/) but it does not gives me just response. Please help…!

---

<div class="post-metadata">

**Author:** ![toza-mimoza](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/toza-mimoza/32/19139_2.png) [@toza-mimoza](https://forum.rasa.com/u/toza-mimoza)\
**Post date:** [February 3, 2022, 3:21pm UTC](https://forum.rasa.com/t/get-rasa-chatbot-response-from-apis/51106/2 "2022-02-03T15:21:47Z")

</div>

Hi @Sajjadmanal , you can try using `requests` Python module in Django backend, [enable REST channel](https://rasa.com/docs/rasa/2.x/connectors/your-own-website), run Rasa with `rasa run --enable-api` and then send POST requests from Django backend pointing to your chatbot.

---

<div class="post-metadata">

**Author:** ![Sajjadmanal](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/sajjadmanal/32/18330_2.png) [@Sajjadmanal](https://forum.rasa.com/u/Sajjadmanal)\
**Post date:** [February 3, 2022, 4:01pm UTC](https://forum.rasa.com/t/get-rasa-chatbot-response-from-apis/51106/4 "2022-02-03T16:01:42Z")

</div>

@stephens please help

---

<div class="post-metadata">

**Author:** ![Sajjadmanal](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/sajjadmanal/32/18330_2.png) [@Sajjadmanal](https://forum.rasa.com/u/Sajjadmanal)\
**Post date:** [February 3, 2022, 4:02pm UTC](https://forum.rasa.com/t/get-rasa-chatbot-response-from-apis/51106/6 "2022-02-03T16:02:53Z")

</div>

@ChrisRahme Please help

---

<div class="post-metadata">

**Author:** ![stephens](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/stephens/32/1632_2.png) [@stephens](https://forum.rasa.com/u/stephens)\
**Post date:** [February 3, 2022, 5:18pm UTC](https://forum.rasa.com/t/get-rasa-chatbot-response-from-apis/51106/7 "2022-02-03T17:18:02Z")

</div>

Did you configure the `rest:` endpoint in the `credentials.yml` as documented [here](https://rasa.com/docs/rasa/connectors/your-own-website/#restinput). 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:

```auto
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.

```auto
curl --location --request POST 'https://gstephens.org/webhooks/rest/webhook' \
 --header 'Content-Type: application/json' \
 --data-raw '{ "sender": "curl", "message": "Hello"}'

```

---

<div class="post-metadata">

**Author:** ![ChrisRahme](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/chrisrahme/32/15572_2.png) [@ChrisRahme](https://forum.rasa.com/u/ChrisRahme)\
**Post date:** [February 3, 2022, 5:23pm UTC](https://forum.rasa.com/t/get-rasa-chatbot-response-from-apis/51106/8 "2022-02-03T17:23:23Z")

</div>

Please don’t spam tags - there’s a reason multiple tagging isn’t allowed in a post as mentioned in the [Code of Conduct](http://forum.rasa.com/t/updated-code-of-conduct/15008):

> 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](http://forum.rasa.com/t/how-to-ask-a-great-question/15009)”, 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](https://github.com/ChrisRahme/fyp-chatbot/blob/main/credentials.yml). You then make a `POST` request to `http://localhost:5005/webhooks/rest/webhook` with the following raw body:

```json
{
    "sender": "User",
    "message": "Hello, world!"
}

```

---

<div class="post-metadata">

**Author:** ![toza-mimoza](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/toza-mimoza/32/19139_2.png) [@toza-mimoza](https://forum.rasa.com/u/toza-mimoza)\
**Post date:** [February 3, 2022, 5:27pm UTC](https://forum.rasa.com/t/get-rasa-chatbot-response-from-apis/51106/9 "2022-02-03T17:27:14Z")

</div>

My post was hidden by the spam filter until now, but now I see others provided an answer.

---

<div class="post-metadata">

**Author:** ![Sajjadmanal](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/sajjadmanal/32/18330_2.png) [@Sajjadmanal](https://forum.rasa.com/u/Sajjadmanal)\
**Post date:** [February 3, 2022, 5:44pm UTC](https://forum.rasa.com/t/get-rasa-chatbot-response-from-apis/51106/10 "2022-02-03T17:44:04Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![Sajjadmanal](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/sajjadmanal/32/18330_2.png) [@Sajjadmanal](https://forum.rasa.com/u/Sajjadmanal)\
**Post date:** [February 3, 2022, 5:44pm UTC](https://forum.rasa.com/t/get-rasa-chatbot-response-from-apis/51106/11 "2022-02-03T17:44:16Z")

</div>

@toza-mimoza thanks

---

<div class="post-metadata">

**Author:** ![Sajjadmanal](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/sajjadmanal/32/18330_2.png) [@Sajjadmanal](https://forum.rasa.com/u/Sajjadmanal)\
**Post date:** [February 3, 2022, 5:44pm UTC](https://forum.rasa.com/t/get-rasa-chatbot-response-from-apis/51106/12 "2022-02-03T17:44:43Z")

</div>

@stephens Thanks. Will try checking this.

---

<div class="post-metadata">

**Author:** ![ChrisRahme](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/chrisrahme/32/15572_2.png) [@ChrisRahme](https://forum.rasa.com/u/ChrisRahme)\
**Post date:** [February 3, 2022, 6:19pm UTC](https://forum.rasa.com/t/get-rasa-chatbot-response-from-apis/51106/13 "2022-02-03T18:19:42Z")

</div>

> [@Sajjadmanal](#):
>
> What’s the URL you are sending your information to? Just want to receive json response of the POST messages.

The REST webhook will take a JSON body and return a JSON response as JSON.

> [@Sajjadmanal](#):
>
> What does your request look like? Request will be like: {“text”:”Hi”} (need a method to post this request.

As mentioned, the request should be

```auto
{
    "sender": "User",
    "message": "Hello, world!"
}

```

> [@Sajjadmanal](#):
>
> 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

You shoud use `rasa run --enable-api --cors "*" --debug`

> [@Sajjadmanal](#):
>
> What are the relevant configuration points? Don’t understand this one.

Your `endpoints.yml` file

* * *

It’s all mentioned in the [docs for the REST channel](https://rasa.com/docs/rasa/2.x/connectors/your-own-website/#rest-channels).

---

<div class="post-metadata">

**Author:** ![Sajjadmanal](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/sajjadmanal/32/18330_2.png) [@Sajjadmanal](https://forum.rasa.com/u/Sajjadmanal)\
**Post date:** [February 8, 2022, 7:00am UTC](https://forum.rasa.com/t/get-rasa-chatbot-response-from-apis/51106/14 "2022-02-08T07:00:05Z")

</div>

Thanks @ChrisRahme

---

<div class="post-metadata">

**Author:** ![ChrisRahme](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/chrisrahme/32/15572_2.png) [@ChrisRahme](https://forum.rasa.com/u/ChrisRahme)\
**Post date:** [February 8, 2022, 4:30pm UTC](https://forum.rasa.com/t/get-rasa-chatbot-response-from-apis/51106/15 "2022-02-08T16:30:20Z")

</div>

Happy to help 🙂
