简体   繁体   中英

get specific intent using events in Dialogflow Essentials

Trying to get specific intent using events in Dialogflow Essentials

below is the request

   {
    "queryInput": {
        "event": {
            "name": "start",
            "languageCode": "en"
        }
    }
}

response:

{
"responseId": "4f2e-8de0-e5ae7ef17a60-32d6a6f2",
"queryResult": {
    "action": "input.unknown",
    "parameters": {},
    "allRequiredParamsPresent": true
}
    

Same working when using text. Would like to make it work using event as well

{
    "queryInput": {
        "text": {
            "text": "start",
            "languageCode": "en"
        }
    }
}

response:

{
    "responseId": "4e9b-b131-f5598b8d7f11-32d6a6f2",
    "queryResult": {
        "queryText": "start",
        "parameters": {},
        "allRequiredParamsPresent": true
}

Make sure that the intent has an event attached to it so you can detect intents based on events.

Intent configuration:

在此处输入图像描述

在此处输入图像描述

Request body:

{
  "queryInput": {
    "event": {
      "name": "test",
      "languageCode": "en"
    }
  }
}

Response when used detectIntent endpoint:

{
  "responseId": "7330fd68-82d1-4fa5-b5a1-555a9d4f649b-32d6a6f2",
  "queryResult": {
    "queryText": "test",
    "parameters": {},
    "allRequiredParamsPresent": true,
    "fulfillmentText": "From API",
    "fulfillmentMessages": [
      {
        "text": {
          "text": [
            "From API"
          ]
        }
      }
    ],
    "outputContexts": [
      {
        "name": "projects/xxxxxx/agent/sessions/1234/contexts/__system_counters__",
        "lifespanCount": 1,
        "parameters": {
          "no-input": 0,
          "no-match": 0
        }
      }
    ],
    "intent": {
      "name": "projects/xxxxxx/agent/intents/05356807-86f4-4a13-8079-6745b110a4d5",
      "displayName": "test intent"
    },
    "intentDetectionConfidence": 1,
    "languageCode": "en"
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM