How to make http call on DialogFlow v2 using Javascript ajax call

后端 未结 6 434
时光说笑
时光说笑 2020-12-19 11:17

I found this example on the official site of DialogFlow using Node.js and it is working fine, but I dont know how do I integrate this into my web application.

Is it

6条回答
  •  长情又很酷
    2020-12-19 11:53

    You can easily call Dialogflow's V2 API detectIntent endpoint from jQuery.

    The API docs show the URL and request formats:

    POST https://dialogflow.googleapis.com/v2/{session=projects/*/agent/sessions/*}:detectIntent
    
    {
      "queryParams": {
        object(QueryParameters)
      },
      "queryInput": {
        object(QueryInput)
      },
      "inputAudio": string
    }
    

    Authentication works slightly differently; instead of using an access token, you'll create a service account and key using the Cloud dashboard. This documentation page explains how.

提交回复
热议问题