为什么 `actions.intent.TRANSACTION_DECISION ` 没有被触发?
Why `actions.intent.TRANSACTION_DECISION ` is not triggered?
我想使用 Dialogflow 和 Google Assistant 以及 Google Transactions API 创建一个聊天机器人,以使用户能够订购一些商品。现在我的代理包含以下四个意图:
Default Welcome Intent
(文字回复:您好,请问您要买巧克力盒吗?)
Default Fallback Intent
Int3
(训练短语:Yes, I want, fulfilment: enabled webhook)
Int4
(事件:actions_intent_TRANSACTION_DECISION
,实现:已启用 webhook)
我正在使用 Dialogflow Json 而不是 Node.js 将我的代理与事务连接 API。我想通过最终用户通过使用 Google 操作的 actions.intent.TRANSACTION_DECISION
操作满足交易要求来为用户构建购物车和订单。出于这个原因,遵循 Google 文档,当 Int3
被触发时,我正在使用连接 Google Assistant 我的后端的 webhook,它发回以下 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
也没有被触发。
我只得到 onn Google 助手(当 Int3
被触发并且上面的 json 作为我后端的响应发送时)下面的 message/error :
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."。然而,我测试了这个 link 中所有可能的解决方案,但到目前为止没有任何一个对我有用。
另外,请记住,我已经触发了 Google Transactions API (actions.intent.TRANSACTION_REQUIREMENTS_CHECK
, actions.intent.DELIVERY_ADDRESS
, actions.intent.SIGN_IN
) 的所有其他内置意图,它们我的 agent/app 一切正常。由于某些原因,只有 actions.intent.TRANSACTION_DECISION
returns 这个错误 (Sorry, something went wrong. Please try again later.
) 给我。
我终于解决了这个问题。它在某种意义上与我上面 post 的最后一段有关。通过这个,我的意思是它与测试此应用程序所需的一些 configuration/permission 事情有关,而不是与我的 json 等有关
但是,我不知道为什么这只发生在 actions.intent.TRANSACTION_DECISION
中,而在其余 Google 交易 API 内置意图中根本没有发生(actions.intent.TRANSACTION_REQUIREMENTS_CHECK
, actions.intent.DELIVERY_ADDRESS
, actions.intent.SIGN_IN
).
具体来说,在 Google 操作中,在我选择了我的项目并登录了我的 google 帐户后,我在以下位置填写了所有必需的详细信息:
left sidebar -> DEPLOY -> Directory information -> (Details, Image, Contact Details, Privacy and consent, Additional Information)
在我完成并保存后,这个 actions.intent.TRANSACTION_DECISION
按预期触发,我在 Google 助手(在移动设备 phone 上)上获得了预期的 "cart preview"。
我想使用 Dialogflow 和 Google Assistant 以及 Google Transactions API 创建一个聊天机器人,以使用户能够订购一些商品。现在我的代理包含以下四个意图:
Default Welcome Intent
(文字回复:您好,请问您要买巧克力盒吗?)Default Fallback Intent
Int3
(训练短语:Yes, I want, fulfilment: enabled webhook)Int4
(事件:actions_intent_TRANSACTION_DECISION
,实现:已启用 webhook)
我正在使用 Dialogflow Json 而不是 Node.js 将我的代理与事务连接 API。我想通过最终用户通过使用 Google 操作的 actions.intent.TRANSACTION_DECISION
操作满足交易要求来为用户构建购物车和订单。出于这个原因,遵循 Google 文档,当 Int3
被触发时,我正在使用连接 Google Assistant 我的后端的 webhook,它发回以下 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
也没有被触发。
我只得到 onn Google 助手(当 Int3
被触发并且上面的 json 作为我后端的响应发送时)下面的 message/error :
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."。然而,我测试了这个 link 中所有可能的解决方案,但到目前为止没有任何一个对我有用。
另外,请记住,我已经触发了 Google Transactions API (actions.intent.TRANSACTION_REQUIREMENTS_CHECK
, actions.intent.DELIVERY_ADDRESS
, actions.intent.SIGN_IN
) 的所有其他内置意图,它们我的 agent/app 一切正常。由于某些原因,只有 actions.intent.TRANSACTION_DECISION
returns 这个错误 (Sorry, something went wrong. Please try again later.
) 给我。
我终于解决了这个问题。它在某种意义上与我上面 post 的最后一段有关。通过这个,我的意思是它与测试此应用程序所需的一些 configuration/permission 事情有关,而不是与我的 json 等有关
但是,我不知道为什么这只发生在 actions.intent.TRANSACTION_DECISION
中,而在其余 Google 交易 API 内置意图中根本没有发生(actions.intent.TRANSACTION_REQUIREMENTS_CHECK
, actions.intent.DELIVERY_ADDRESS
, actions.intent.SIGN_IN
).
具体来说,在 Google 操作中,在我选择了我的项目并登录了我的 google 帐户后,我在以下位置填写了所有必需的详细信息:
left sidebar -> DEPLOY -> Directory information -> (Details, Image, Contact Details, Privacy and consent, Additional Information)
在我完成并保存后,这个 actions.intent.TRANSACTION_DECISION
按预期触发,我在 Google 助手(在移动设备 phone 上)上获得了预期的 "cart preview"。