Mrunal Pradeep Patekar
Mrunal Pradeep Patekar

Reputation: 157

Can someone explain, what does the webhook do in api.ai?

I am new to api.ai. I want to send data to the web server and receive it and then give it to the users? From the documentation that I read, I understood that I have to use a webhook. But I am not sure how will api.ai send and receive the data?

Can the webhook be developed in any language?

Upvotes: 1

Views: 538

Answers (2)

Abhinav Anand
Abhinav Anand

Reputation: 639

You can visualize the working of a webhook like a block where data request comes in JSON format somewhat like this:

{
  "id": "7aef9329-4a32-4d59-b661-8bf380a0f35b",
  "timestamp": "2017-06-07T05:36:12.641Z",
  "lang": "en",
  "result": {
    "source": "agent",
    "resolvedQuery": "hi",
    "action": "order.pizza",
    "actionIncomplete": true,
    "parameters": {
      "address": "",
      "crust": "",
      "sauce": "",
      "size": "",
      "time": "",
      "topping": "",
      "type": ""
    }
  }
}

and another json file is returned to it according to the prescribed settings.

Upvotes: 0

Tom
Tom

Reputation: 17844

The webhook is a web service that you implement in any language and on any platform, with an HTTP (must be https for ghome) and JSON interface, that fullfils (in their lingo) a user intent.

API.AI matches a user utterance to an intent (which then suggests entity values and a response) and they pass these in the call to your web service. You do whatever processing you need - your domain logic - and then return a speech response for the user and optionally some API.AI contexts.

You can read more about it (and about slot filling fulfillment which is a little different) here.

Upvotes: 1

Related Questions