11

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

rekire
  • 47,260
  • 30
  • 167
  • 264
  • 1
    This is the API.AI JSON response, which is returned after your intent whether or not you've configured any webhook. Have you created a webhook to your backend? – Connor Neville Dec 22 '16 at 20:08
  • Sure I did configures the callback sometimes (when I remove the slack integration and re add it) it works fine. I'm not sure why it stops working. – rekire Dec 22 '16 at 20:11
  • Do you have some logs on your backend side? Possible the requests are failing/returning some non-200 code? – Connor Neville Dec 22 '16 at 20:12
  • The access log of my apache is empty, that means there is just the average noise for the standard hacking bots. You know... – rekire Dec 22 '16 at 20:14
  • @ConnorNeville I added a screenshot as proof ;) – rekire Dec 22 '16 at 20:59
  • Maybe a caching issue? – Zuzlx Dec 22 '16 at 21:02
  • @Zuzlx http://shouldiblamecaching.com/? hehe but no I entered different terms which could not been cached. – rekire Dec 22 '16 at 21:03
  • Sometimes the query you do go to the "defaluts intents" and not yours, you might need to check what is happening with your requests in API.AI. There is the training tab, where you can click on your requests and see which intent was selected by API.AI, you might have to select manually which intent you want for this type of request. Then it will learn. Hope this helps! – Samuel Jan 03 '17 at 10:39

1 Answers1

2

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 .

Ajay Rawat
  • 161
  • 2
  • 12