Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

API.AI does not connect to my back-end

I'm writing an agent using API.AI I'm observing that my back-end is not called everytime. I can see that in my access logs. Any idea what can cause the issue?

Here is the response of the console:

{
  "id": "c1902c75-1550-43f6-9cc8-b0461f1dfac7",
  "timestamp": "2016-12-22T19:58:13.49Z",
  "result": {
    "source": "agent",
    "resolvedQuery": "echo test",
    "action": "",
    "actionIncomplete": false,
    "parameters": {
      "myInput": "test"
    },
    "contexts": [],
    "metadata": {
      "intentId": "062b4383-06a0-40fe-bbeb-9189db49aeb8",
      "webhookUsed": false,
      "webhookForSlotFillingUsed": "false",
      "intentName": "Response"
    },
    "fulfillment": {
      "speech": "",
      "messages": [
        {
          "type": 0,
          "speech": ""
        }
      ]
    },
    "score": 0.75
  },
  "status": {
    "code": 200,
    "errorType": "success"
  },
  "sessionId": "70be8f65-81f0-40be-a271-84a2d4960224"
}

I see there no error which explains why my backend is not called.

Here is a screenshot of my intent:

my intent with webhook

like image 703
rekire Avatar asked Dec 22 '16 20:12

rekire


1 Answers

You have not given any value in the action key of the intent.Give some action name and keep this same name of your function which will accept the parameters from the api.ai

basically the flow is

1)user enters an input.

2)api.ai tries to match the user's input with the intents defined by you, if not found it will got to the fallback intent.

3)once the proper intent is matched then api.ai tries to extract the parameters from the user's sentence.

4)once all the required parameters are found it will call the action which you have defined in the intent.

NOTE: if none of the parameters are required in the intent it directly calls the action .

like image 182
Ajay Rawat Avatar answered Nov 05 '22 20:11

Ajay Rawat