且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用Javascript Ajax调用在DialogFlow v2上进行http调用

更新时间:2022-05-19 05:35:27

您可以轻松调用Dialogflow的V2 API detectIntent $ c

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

API文档显示URL和请求格式:

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
}

身份验证的工作方式略有不同;您无需使用访问令牌,而可以使用Cloud信息中心创建服务帐户和密钥。 此文档页面说明了操作方法。

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.