【问题标题】:Why `actions.intent.TRANSACTION_DECISION ` is not triggered?为什么不触发`actions.intent.TRANSACTION_DECISION`?
【发布时间】:2018-10-27 14:39:49
【问题描述】:

我想使用 Dialogflow 和 Google Assistant 以及 Google Transactions API 创建一个聊天机器人,以使用户能够订购一些商品。目前我的代理包含以下四个意图:

  • Default Welcome Intent(短信回复:你好,要买巧克力盒吗?)
  • Default Fallback Intent
  • Int3(训练短语:是的,我想要,实现:启用 webhook)
  • Int4(事件:actions_intent_TRANSACTION_DECISION,实现:启用 webhook)

我正在使用 Dialogflow Json 而不是 Node.js 将我的代理与 Transactions API 连接起来。我想通过使用 Google 操作的 actions.intent.TRANSACTION_DECISION 操作最终用户满足交易要求来为用户构建购物车和订单。出于这个原因,按照谷歌文档,当Int3被触发时,我正在使用一个连接谷歌助手我的后端的网络钩子,它发回以下json(触发actions.intent.TRANSACTION_DECISION):

{
  "payload": {
    "google": {
      "expectUserResponse": true,
      "isSsml": false,
      "noInputPrompts": [],
      "systemIntent": {
        "data": {
          "@type": "type.googleapis.com/google.actions.v2.TransactionDecisionValueSpec",
          "orderOptions": {
            "requestDeliveryAddress": false
          },
          "paymentOptions": {
            "actionProvidedOptions": {
              "displayName": "VISA-1234",
              "paymentType": "PAYMENT_CARD"
            }
          },
          "proposedOrder": {
            "cart": {
              "lineItems": [
                {
                  "id": "My Memoirs",
                  "name": "memoirs_1",
                  "price": {
                    "amount": {
                      "currencyCode": "USD",
                      "nanos": 990000000,
                      "units": 3
                    },
                    "type": "ACTUAL"
                  },
                  "quantity": 1,
                  "subLines": [
                    {
                      "note": "Note from the author"
                    }
                  ],
                  "type": "REGULAR"
                },
                {
                  "id": "Memoirs of a person",
                  "name": "memoirs_2",
                  "price": {
                    "amount": {
                      "currencyCode": "USD",
                      "nanos": 990000000,
                      "units": 5
                    },
                    "type": "ACTUAL"
                  },
                  "quantity": 1,
                  "subLines": [
                    {
                      "note": "Special introduction by author"
                    }
                  ],
                  "type": "REGULAR"
                },
                {
                  "id": "Their memoirs",
                  "name": "memoirs_3",
                  "price": {
                    "amount": {
                      "currencyCode": "USD",
                      "nanos": 750000000,
                      "units": 15
                    },
                    "type": "ACTUAL"
                  },
                  "quantity": 1,
                  "type": "REGULAR"
                },
                {
                  "id": "Our memoirs",
                  "name": "memoirs_4",
                  "price": {
                    "amount": {
                      "currencyCode": "USD",
                      "nanos": 490000000,
                      "units": 6
                    },
                    "type": "ACTUAL"
                  },
                  "quantity": 1,
                  "type": "REGULAR"
                }
              ],
              "merchant": {
                "id": "book_store_1",
                "name": "Book Store"
              },
              "notes": "The Memoir collection",
              "otherItems": []
            },
            "id": "<UNIQUE_ORDER_ID>",
            "otherItems": [
              {
                "id": "Subtotal",
                "name": "subtotal",
                "price": {
                  "amount": {
                    "currencyCode": "USD",
                    "nanos": 220000000,
                    "units": 32
                  },
                  "type": "ESTIMATE"
                },
                "type": "SUBTOTAL"
              },
              {
                "id": "Tax",
                "name": "tax",
                "price": {
                  "amount": {
                    "currencyCode": "USD",
                    "nanos": 780000000,
                    "units": 2
                  },
                  "type": "ESTIMATE"
                },
                "type": "TAX"
              }
            ],
            "totalPrice": {
              "amount": {
                "currencyCode": "USD",
                "nanos": 0,
                "units": 35
              },
              "type": "ESTIMATE"
            }
          }
        },
        "intent": "actions.intent.TRANSACTION_DECISION"
      }
    }
  }
}

请注意,我实际上是从 Google 文档中复制粘贴 json。

但是,Int4 没有被触发,这意味着actions.intent.TRANSACTION_DECISION 也没有被触发。

我只在 Google Assistant 上收到以下消息/错误(当Int3 被触发并且上面的 json 作为我的后端的响应发送时)以下消息/错误:

Sorry, something went wrong. Please try again later.

因此,我无法真正理解我的 json 中有什么问题以及为什么没有触发 actions.intent.TRANSACTION_DECISION

为什么actions.intent.TRANSACTION_DECISION没有被触发?上面的 json 是否有任何未检测到的问题?

我不知道我的问题是否与此有关:Actions on Google returns in simulator "We're sorry, but something went wrong. Please try again."。但是,我从这个链接测试了所有可能的解决方案,到目前为止没有什么对我有用。 另外,请记住,我已经触发了 Google Transactions API 的所有其他内置意图(actions.intent.TRANSACTION_REQUIREMENTS_CHECKactions.intent.DELIVERY_ADDRESSactions.intent.SIGN_IN),它们都可以在我的代理/应用程序中正常工作。出于某种原因,只有actions.intent.TRANSACTION_DECISION 会将此错误(Sorry, something went wrong. Please try again later.)返回给我。

【问题讨论】:

    标签: actions-on-google dialogflow-es


    【解决方案1】:

    最后我解决了这个问题。从某种意义上说,这与我上面帖子的最后一段有关。我的意思是,它与测试此应用程序所需的一些配置/权限有关,而不是与我的 json 等有关。

    但是,我不知道为什么只有actions.intent.TRANSACTION_DECISION 会发生这种情况,而其他 Google Transactions API 内置意图(actions.intent.TRANSACTION_REQUIREMENTS_CHECKactions.intent.DELIVERY_ADDRESSactions.intent.SIGN_IN)根本不会发生这种情况。

    具体来说,在 Google Actions 中,我选择了我的项目并登录了我的 google 帐户后,我在以下位置填写了所有必需的详细信息:

    left sidebar -> DEPLOY -> Directory information -> (Details, Image, Contact Details, Privacy and consent, Additional Information)
    

    在我完成并保存此actions.intent.TRANSACTION_DECISION 后,按预期触发,我在 Google 助理(在手机上)上获得了预期的“购物车预览”。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-10-12
      • 2015-06-16
      • 2022-08-03
      • 1970-01-01
      • 2017-03-16
      • 2014-11-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多