API specification for POST /webhooks/rest/webhook

Hi, is there API specification for POST /webhooks/rest/webhook? It’s only mentioned in 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?

1 Like

check out the blueprint here rasa/channel.py at master · RasaHQ/rasa · GitHub

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

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

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

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:

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

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:

Make sense for you?

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.

Hi @amn41 !

last night I watched your talk in 2018 at some py* conf in NYC :slight_smile: 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 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