【问题标题】:Creating an intent in Google dialog flow V2 API using postman使用邮递员在 Google dialogflow V2 API 中创建缩进
【发布时间】:2020-05-20 15:55:26
【问题描述】:

我正在尝试在我在 google 对话流中创建的代理中创建意图。我可以通过 Google API 控制台创建意图。但是当我通过 Postman 尝试相同的操作时,我遇到了身份验证错误。我不确定我应该使用的授权类型到底是什么,我应该为此使用哪个密钥。在 V2 中用于创建意图的授权类型是什么?用于此目的的密钥是什么?我在哪里可以获得这些密钥?

我在下面提供了我尝试过的详细信息。我遗漏了什么或犯了什么错误?

网址:https://dialogflow.googleapis.com/v2/projects/{项目名称}/agent/intents?languageCode=en

授权:oauth2 和我用作密钥的客户端 ID

请求正文:

{
  "displayName": "ListRooms",
  "priority": 500000,
  "webhookState": "WEBHOOK_STATE_UNSPECIFIED",
  "trainingPhrases": [
    {
      "type": "EXAMPLE",
      "parts": [
        {
          "text": "What rooms are available at 10am today?"
        }
      ]
    }
  ],
  "action": "listRooms",
  "messages": [
    {
      "text": {
        "text": [
          "Here are the available rooms:"
        ]
      }
    }
  ]
}

【问题讨论】:

    标签: dialogflow-es


    【解决方案1】:

    请尝试以下请求

    • 使用api url

    • 在header中发送请求的post方法

    • 将身份验证添加为承载, 您的开发者访问令牌和内容type = application/json

        {
          "contexts": [
            "shop"
          ],
          "events": [],
          "fallbackIntent": false,
          "name": "add-to-list3",
          "priority": 500000,
          "responses": [
            {
              "action": "add.list",
              "affectedContexts": [
                {
                  "lifespan": 5,
                  "name": "shop",
                  "parameters": {}
                },
                {
                  "lifespan": 5,
                  "name": "chosen-fruit 1",
                  "parameters": {}
                }
              ],
              "defaultResponsePlatforms": {
                "google": true
              },
              "messages": [
                {
                  "platform": "google",
                  "textToSpeech": "Okay. How many $fruit 1?",
                  "type": "simple_response"
                },
                {
                  "speech": "Okay how many $fruit?",
                  "type": 0
                }
              ],
              "parameters": [
                {
                  "dataType": "@fruit",
                  "isList": true,
                  "name": "fruit",
                  "prompts": [
                    "I didn't get that. What fruit did you want 1?"
                  ],
                  "required": true,
                  "value": "$fruit"
                }
              ],
              "resetContexts": false
            }
          ],
          "templates": [
            "@fruit:fruit ",
            "Add @fruit:fruit ",
            "I need @fruit:fruit "
          ],
          "userSays": [
            {
              "count": 0,
              "data": [
                {
                  "alias": "fruit",
                  "meta": "@fruit",
                  "text": "oranges",
                  "userDefined": true
                }
              ]
            },
            {
              "count": 0,
              "data": [
                {
                  "text": "Add "
                },
                {
                  "alias": "fruit",
                  "meta": "@fruit",
                  "text": "bananas",
                  "userDefined": true
                }
              ]
            },
            {
              "count": 0,
              "data": [
                {
                  "text": "I need "
                },
                {
                  "alias": "fruit",
                  "meta": "@fruit",
                  "text": "apples",
                  "userDefined": true
                }
              ]
            }
          ],
          "webhookForSlotFilling": false,
          "webhookUsed": false
        }
    
    

    希望有帮助

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-23
      • 1970-01-01
      • 1970-01-01
      • 2017-05-19
      相关资源
      最近更新 更多