# API specification for POST /webhooks/rest/webhook

**URL:** <https://forum.rasa.com/t/api-specification-for-post-webhooks-rest-webhook/14922>\
**Category:** Rasa Open Source\
**Created:** [August 28, 2019, 9:22am UTC](https://forum.rasa.com/t/api-specification-for-post-webhooks-rest-webhook/14922 "2019-08-28T09:22:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![kaladin](https://avatars.discourse-cdn.com/v4/letter/k/f475e1/32.png) [@kaladin](https://forum.rasa.com/u/kaladin)\
**Post date:** [August 28, 2019, 9:22am UTC](https://forum.rasa.com/t/api-specification-for-post-webhooks-rest-webhook/14922/1 "2019-08-28T09:22:42Z")

</div>

Hi, is there API specification for POST /webhooks/rest/webhook? It’s only mentioned in [Your Own Website](https://rasa.com/docs/rasa/user-guide/connectors/your-own-website/) that I can post json as a body like this

```
{
  "sender": "Rasa",
  "message": "Hi there!"
}

```

and the response is

```
[
  {"text": "Hey Rasa!"}, {"image": "http://example.com/image.jpg"}
]

```

But what about HTTP statuses other than 200?

---

<div class="post-metadata">

**Author:** ![amn41](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/amn41/32/20_2.png) [@amn41](https://forum.rasa.com/u/amn41)\
**Post date:** [August 28, 2019, 12:14pm UTC](https://forum.rasa.com/t/api-specification-for-post-webhooks-rest-webhook/14922/2 "2019-08-28T12:14:14Z")

</div>

check out the blueprint here [rasa/channel.py at master · RasaHQ/rasa · GitHub](https://github.com/RasaHQ/rasa/blob/master/rasa/core/channels/channel.py#L362)

adding this to the docs would be an awesome contribution, if you’re up for it!

---

<div class="post-metadata">

**Author:** ![amn41](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/amn41/32/20_2.png) [@amn41](https://forum.rasa.com/u/amn41)\
**Post date:** [September 2, 2019, 1:06pm UTC](https://forum.rasa.com/t/api-specification-for-post-webhooks-rest-webhook/14922/3 "2019-09-02T13:06:14Z")

</div>

hi @kaladin ! would you be up for taking this on?

---

<div class="post-metadata">

**Author:** ![kaladin](https://avatars.discourse-cdn.com/v4/letter/k/f475e1/32.png) [@kaladin](https://forum.rasa.com/u/kaladin)\
**Post date:** [September 3, 2019, 7:23am UTC](https://forum.rasa.com/t/api-specification-for-post-webhooks-rest-webhook/14922/4 "2019-09-03T07:23:54Z")

</div>

I would love to contribute, but I dont think I have enough knowledge about Rasa to do this right now

---

<div class="post-metadata">

**Author:** ![solyarisoftware](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/solyarisoftware/32/8464_2.png) [@solyarisoftware](https://forum.rasa.com/u/solyarisoftware)\
**Post date:** [April 28, 2020, 5:08pm UTC](https://forum.rasa.com/t/api-specification-for-post-webhooks-rest-webhook/14922/5 "2020-04-28T17:08:49Z")

</div>

Hi Alan, A suggestion and a request:

**1. A suggestion**

I’d suggest to add the mentioned [page that describe Rasa Core webhook API interface](https://rasa.com/docs/rasa/user-guide/connectors/your-own-website/):

- 1.1 to the [wiki documentation page](https://rasa.com/docs/rasa/):
- 1.2 and to the [HTTP API doc](https://rasa.com/docs/rasa/api/http-api/):

I became crazy for hours finding info. or I’m lost something? (that’s absolutely possible! 🙂 ).

**2. A CR request (TBD)**

Now the REST API return 2 attributes:` recipient_id` and `text` / other media, as in the example:

```
$ curl -s localhost:5005/webhooks/rest/webhook -d '{ "sender": "Giorgio", "message": "I am a bit sad"}' | json
[
    {
        "recipient_id": "Giorgio",
        "text": "Here is something to cheer you up:"
    },
    {
        "image": "https://i.imgur.com/nGF1K8f.jpg",
        "recipient_id": "Giorgio"
    },
    {
        "recipient_id": "Giorgio",
        "text": "Are you feeling better?"
    }
]

```

It could be great if this endpoint could return also the name of the intent that produced that “output” template, like in this proposed modification:

```
{
  "intent": "mood_unhappy",
  "reply": [
        {
            "recipient_id": "Giorgio",
            "text": "Here is something to cheer you up:"
        },
        {
            "image": "https://i.imgur.com/nGF1K8f.jpg",
            "recipient_id": "Giorgio"
        },
        {
            "recipient_id": "Giorgio",
            "text": "Are you feeling better?"
        }
    ]
}

```

Why? The reason is to have at run-time an “explanation” of the bot reply, for possible postprocessing/filtering That’s also related with [my question on stackoverflow](https://stackoverflow.com/questions/61481535/using-rasa-to-build-an-email-bot-in-general-about-email-bots-dialog-management/):

Make sense for you?

---

<div class="post-metadata">

**Author:** ![amn41](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/amn41/32/20_2.png) [@amn41](https://forum.rasa.com/u/amn41)\
**Post date:** [May 1, 2020, 10:51am UTC](https://forum.rasa.com/t/api-specification-for-post-webhooks-rest-webhook/14922/6 "2020-05-01T10:51:10Z")

</div>

hi @solyarisoftware! yes I agree this needs to be documented better. As for sending the template name in addition to the text, I think it’s not a bad idea, but please create an issue and we can consider it more carefully.

As a workaround for now, you can subclass the `Rest` channel and add this yourself for now.

---

<div class="post-metadata">

**Author:** ![solyarisoftware](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/solyarisoftware/32/8464_2.png) [@solyarisoftware](https://forum.rasa.com/u/solyarisoftware)\
**Post date:** [May 1, 2020, 11:21am UTC](https://forum.rasa.com/t/api-specification-for-post-webhooks-rest-webhook/14922/7 "2020-05-01T11:21:53Z")

</div>

Hi @amn41 !

last night I watched your talk in 2018 at some py\* conf in NYC 🙂I agree in your approach & biz vision. BTW I try to disseminate RASA ecosystem on twitter/linkedin.

Back on point, I opened a [CR request](https://github.com/RasaHQ/rasa/issues/5768) on github. About the REST channel subclass, yes I’ll take a look, but because I’m not a python developer, that’s not easy but I’ll try!

Thanks

giorgio
