Dialogflow API v1, v2 の webhook リクエスト JSON 例

参考

Dialogflow の設定

  • Agent 名: HelloDialogflowAPI2
  • Intent 名: TestIntent1
  • Training phrases:
    • I like green
    • I like red
    • I like blue
  • Parameters:
    • Parameter name: color
    • Entity: @sys.color

呼び出し元

  • Device: Simulator
  • Surface: Phone
  • Language: en-us
  • Location: Googleplex, Mountain View, CA 94043, United States

Webhook リクエスト時に送られる JSON

I like *** をキーボードで入力して呼び出し

v1 API

{
  "originalRequest": {
    "source": "google",
    "version": "2",
    "data": {
      "isInSandbox": true,
      "surface": {
        "capabilities": [
          {
            "name": "actions.capability.SCREEN_OUTPUT"
          },
          {
            "name": "actions.capability.AUDIO_OUTPUT"
          },
          {
            "name": "actions.capability.WEB_BROWSER"
          },
          {
            "name": "actions.capability.MEDIA_RESPONSE_AUDIO"
          }
        ]
      },
      "requestType": "SIMULATOR",
      "inputs": [
        {
          "rawInputs": [
            {
              "query": "I like green",
              "inputType": "KEYBOARD"
            }
          ],
          "arguments": [
            {
              "rawText": "I like green",
              "textValue": "I like green",
              "name": "text"
            }
          ],
          "intent": "actions.intent.TEXT"
        }
      ],
      "user": {
        "lastSeen": "2019-02-11T09:04:57Z",
        "locale": "en-US",
        "userId": "ABwppHGQGr22Z3CnjL-7Hnww_VTTiG9h8n-q9aNsdNlm0OnXPmnX5O8mBi0xJtP5GrhYpQ9gCjJh8khWcmBPuMgnwQ"
      },
      "conversation": {
        "conversationId": "ABwppHH85J9F5oe1VxwSp5TvgkfR-W6DT0Rb_vzAWROIahZIFkKoZHghfajfLrnwSAQqNWYCGVWol7fP1pRRVcVp4A",
        "type": "ACTIVE",
        "conversationToken": "[]"
      },
      "availableSurfaces": [
        {
          "capabilities": [
            {
              "name": "actions.capability.SCREEN_OUTPUT"
            },
            {
              "name": "actions.capability.AUDIO_OUTPUT"
            },
            {
              "name": "actions.capability.WEB_BROWSER"
            }
          ]
        }
      ]
    }
  },
  "id": "baa9ed27-e99b-41b0-9d09-35fe3af565ea",
  "timestamp": "2019-02-11T11:26:09.201Z",
  "lang": "en-us",
  "result": {
    "source": "agent",
    "resolvedQuery": "I like green",
    "speech": "",
    "action": "",
    "actionIncomplete": false,
    "parameters": {
      "color": "green"
    },
    "contexts": [
      {
        "name": "actions_capability_screen_output",
        "parameters": {
          "color": "green",
          "color.original": "green"
        },
        "lifespan": 0
      },
      {
        "name": "actions_capability_audio_output",
        "parameters": {
          "color": "green",
          "color.original": "green"
        },
        "lifespan": 0
      },
      {
        "name": "google_assistant_input_type_keyboard",
        "parameters": {
          "color": "green",
          "color.original": "green"
        },
        "lifespan": 0
      },
      {
        "name": "actions_capability_web_browser",
        "parameters": {
          "color": "green",
          "color.original": "green"
        },
        "lifespan": 0
      },
      {
        "name": "actions_capability_media_response_audio",
        "parameters": {
          "color": "green",
          "color.original": "green"
        },
        "lifespan": 0
      }
    ],
    "metadata": {
      "matchedParameters": [
        {
          "dataType": "@sys.color",
          "name": "color",
          "value": "$color",
          "isList": false
        }
      ],
      "isFallbackIntent": "false",
      "intentName": "TestIntent1",
      "isResponseToSlotfilling": false,
      "intentId": "43e7fce7-6325-4087-968d-6a65ed66b34a",
      "webhookUsed": "true",
      "webhookForSlotFillingUsed": "false",
      "nluResponseTime": 23
    },
    "fulfillment": {
      "speech": "",
      "messages": [
        {
          "type": 0,
          "speech": ""
        }
      ]
    },
    "score": 1.0
  },
  "status": {
    "code": 200,
    "errorType": "success"
  },
  "sessionId": "ABwppHH85J9F5oe1VxwSp5TvgkfR-W6DT0Rb_vzAWROIahZIFkKoZHghfajfLrnwSAQqNWYCGVWol7fP1pRRVcVp4A"
}

v2 API

{
  "responseId": "acb3e31d-6d01-47e0-a862-4724a11049af",
  "queryResult": {
    "queryText": "i like blue",
    "parameters": {
      "color": "blue"
    },
    "allRequiredParamsPresent": true,
    "fulfillmentMessages": [
      {
        "text": {
          "text": [
            ""
          ]
        }
      }
    ],
    "outputContexts": [
      {
        "name": "projects/hellodialogflowapi2/agent/sessions/ABwppHFWb_kxnN18WEBdA9fzj55t2I1kIs88kEAwhj2vY4J0xDAEfw9iU-2t48aI3MSIxVEAIfxNZNt-EJvfUibRfA/contexts/actions_capability_screen_output",
        "parameters": {
          "color": "blue",
          "color.original": "blue"
        }
      },
      {
        "name": "projects/hellodialogflowapi2/agent/sessions/ABwppHFWb_kxnN18WEBdA9fzj55t2I1kIs88kEAwhj2vY4J0xDAEfw9iU-2t48aI3MSIxVEAIfxNZNt-EJvfUibRfA/contexts/actions_capability_audio_output",
        "parameters": {
          "color": "blue",
          "color.original": "blue"
        }
      },
      {
        "name": "projects/hellodialogflowapi2/agent/sessions/ABwppHFWb_kxnN18WEBdA9fzj55t2I1kIs88kEAwhj2vY4J0xDAEfw9iU-2t48aI3MSIxVEAIfxNZNt-EJvfUibRfA/contexts/google_assistant_input_type_keyboard",
        "parameters": {
          "color": "blue",
          "color.original": "blue"
        }
      },
      {
        "name": "projects/hellodialogflowapi2/agent/sessions/ABwppHFWb_kxnN18WEBdA9fzj55t2I1kIs88kEAwhj2vY4J0xDAEfw9iU-2t48aI3MSIxVEAIfxNZNt-EJvfUibRfA/contexts/actions_capability_media_response_audio",
        "parameters": {
          "color": "blue",
          "color.original": "blue"
        }
      },
      {
        "name": "projects/hellodialogflowapi2/agent/sessions/ABwppHFWb_kxnN18WEBdA9fzj55t2I1kIs88kEAwhj2vY4J0xDAEfw9iU-2t48aI3MSIxVEAIfxNZNt-EJvfUibRfA/contexts/actions_capability_web_browser",
        "parameters": {
          "color": "blue",
          "color.original": "blue"
        }
      }
    ],
    "intent": {
      "name": "projects/hellodialogflowapi2/agent/intents/43e7fce7-6325-4087-968d-6a65ed66b34a",
      "displayName": "TestIntent1"
    },
    "intentDetectionConfidence": 1.0,
    "languageCode": "en-us"
  },
  "originalDetectIntentRequest": {
    "source": "google",
    "version": "2",
    "payload": {
      "isInSandbox": true,
      "surface": {
        "capabilities": [
          {
            "name": "actions.capability.WEB_BROWSER"
          },
          {
            "name": "actions.capability.MEDIA_RESPONSE_AUDIO"
          },
          {
            "name": "actions.capability.SCREEN_OUTPUT"
          },
          {
            "name": "actions.capability.AUDIO_OUTPUT"
          }
        ]
      },
      "requestType": "SIMULATOR",
      "inputs": [
        {
          "rawInputs": [
            {
              "query": "i like blue",
              "inputType": "KEYBOARD"
            }
          ],
          "arguments": [
            {
              "rawText": "i like blue",
              "textValue": "i like blue",
              "name": "text"
            }
          ],
          "intent": "actions.intent.TEXT"
        }
      ],
      "user": {
        "lastSeen": "2019-02-11T05:33:45Z",
        "locale": "en-US",
        "userId": "ABwppHGQGr22Z3CnjL-7Hnww_VTTiG9h8n-q9aNsdNlm0OnXPmnX5O8mBi0xJtP5GrhYpQ9gCjJh8khWcmBPuMgnwQ"
      },
      "conversation": {
        "conversationId": "ABwppHFWb_kxnN18WEBdA9fzj55t2I1kIs88kEAwhj2vY4J0xDAEfw9iU-2t48aI3MSIxVEAIfxNZNt-EJvfUibRfA",
        "type": "ACTIVE",
        "conversationToken": "[]"
      },
      "availableSurfaces": [
        {
          "capabilities": [
            {
              "name": "actions.capability.WEB_BROWSER"
            },
            {
              "name": "actions.capability.SCREEN_OUTPUT"
            },
            {
              "name": "actions.capability.AUDIO_OUTPUT"
            }
          ]
        }
      ]
    }
  },
  "session": "projects/hellodialogflowapi2/agent/sessions/ABwppHFWb_kxnN18WEBdA9fzj55t2I1kIs88kEAwhj2vY4J0xDAEfw9iU-2t48aI3MSIxVEAIfxNZNt-EJvfUibRfA"
}