0

I want to create a chatbot with Dialogflow and Google Assistant along with Google Transactions API for enabling a user to order some items. For now my agent contains the following four intents:

  • Default Welcome Intent (text response: Hello, do you want to buy a chocolate box?)
  • Default Fallback Intent
  • Int3 (training phrase: Yes, I want, fulfilment: enabled webhook)
  • Int4 (event: actions_intent_TRANSACTION_DECISION, fulfilment: enabled webhook)

I am using Dialogflow Json instead of Node.js to connect my agent with Transactions API. I want to build a cart and an order for the user by using finally that the user meets the transaction requirements by using the actions.intent.TRANSACTION_DECISION action of Google actions. For this reason, following Google docs, when Int3 is triggered I am using a webhook which connect Google Assistant my back-end which sends back the following json (to trigger 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"
      }
    }
  }
}

Notice that I am essentially copying-pasting the jsons from Google docs.

However, Int4 is not triggered which means that actions.intent.TRANSACTION_DECISION is also not triggered .

I only get onn Google Assistant (when Int3 is triggered and the above json is sent as a response from my back-end) the following message/error:

Sorry, something went wrong. Please try again later.

Therefore, I cannot really understand what is wrong in my json and why actions.intent.TRANSACTION_DECISION is not triggered.

Why actions.intent.TRANSACTION_DECISION is not triggered? Is there any undetected problem with the json above?

I do not know if my problem has anything to do with this: Actions on Google returns in simulator "We're sorry, but something went wrong. Please try again.". However, I tested all the possible solutions from this link and nothing so far really worked for me. Also, keep in mind that I have already triggered all the other built-in intents of Google Transactions API (actions.intent.TRANSACTION_REQUIREMENTS_CHECK, actions.intent.DELIVERY_ADDRESS, actions.intent.SIGN_IN) and they all work fine with my agent/app. For some reason, only actions.intent.TRANSACTION_DECISION returns this error (Sorry, something went wrong. Please try again later.) to me.

Outcast
  • 4,967
  • 5
  • 44
  • 99

1 Answers1

1

Finally I solved this. It had to do in a sense with the last paragraph at my post above. By this, I mean that it had to do with some configuration/permission things required to test this app and not something with my json etc.

However, I do not know exactly why this was happening only with actions.intent.TRANSACTION_DECISION and not at all with the rest of the Google Transactions API built-in intents (actions.intent.TRANSACTION_REQUIREMENTS_CHECK, actions.intent.DELIVERY_ADDRESS, actions.intent.SIGN_IN).

Specifically, at Google Actions, after I selected my project and I signed in my google account, I filled in all the required details at the following location:

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

After I completed and saved this actions.intent.TRANSACTION_DECISION was triggered as expected and I was getting the anticipated "cart preview" on Google Assistant (on the mobile phone).

Outcast
  • 4,967
  • 5
  • 44
  • 99