Search code examples
dialogflow-esactions-on-googledialogflow-es-fulfillment

Having trouble with Google Assistant repeating previous message in Dialogflow


I'm working on a very simple Dialogflow with about 15-20 intents. All of these intents use a text response except one. The only intent that does not use a text response is called 'repeat'. The intent (repeat) should be able to repeat whatever was previously said by Google Assistant.

enter image description here

enter image description here

I've tried to set this up using Multivocal but have not been successful. When I type a command into the test simulator I'll get the initial response, but when I follow up with 'repeat' the default response of 'Not available' is returned. The webhook times out when I look at the Diagnostic Info. My sense is that I've configured something wrong because I've read these answers and not been able to solve my problem:

I'm using the inline editor within Dialogflow my index.js looks like:

const Multivocal = require('multivocal');
const conf = {
Local: {
    en: {
      Response: {
        "Action.multivocal.repeat": "Let me try again",
      }
    }
  }
};
new Multivocal.Config.Simple( conf );
exports.webhook = Multivocal.processFirebaseWebhook;
exports.dialogflowFirebaseFulfillment = Multivocal.processFirebaseWebhook;

And my package.json includes the Multivocal dependency:

"multivocal": "^0.15.0"

My understanding based on the above SO questions is that these config values would be enough and I don't need to do any coding, but I'm clearly screwing something (many things?) up. How can I get the prior response in Google Assistant to repeat when a user says 'repeat' or something similar? Multivocal seems like a simple solution, if I can do it that way.

Additional logs:

Fulfillment request (removed project id information):

{
  "responseId": "--",
  "queryResult": {
    "queryText": "repeat",
    "action": "multivocal.repeat",
    "parameters": {},
    "allRequiredParamsPresent": true,
    "fulfillmentMessages": [
      {
        "text": {
          "text": [
            ""
          ]
        }
      }
    ],
    "outputContexts": [
      {
        "name": "project info",
        "parameters": {
          "no-input": 0,
          "no-match": 0
        }
      }
    ],
    "intent": {
      "name": "project info",
      "displayName": "repeat"
    },
    "intentDetectionConfidence": 1,
    "languageCode": "en"
  },
  "originalDetectIntentRequest": {
    "payload": {}
  },
  "session": "project info"
}

Raw API response (removed project and response id)

{
  "responseId": "",
  "queryResult": {
    "queryText": "repeat",
    "action": "multivocal.repeat",
    "parameters": {},
    "allRequiredParamsPresent": true,
    "fulfillmentMessages": [
      {
        "text": {
          "text": [
            ""
          ]
        }
      }
    ],
    "intent": {
      "name": "projects info",
      "displayName": "repeat"
    },
    "intentDetectionConfidence": 1,
    "diagnosticInfo": {
      "webhook_latency_ms": 4992
    },
    "languageCode": "en"
  },
  "webhookStatus": {
    "code": 4,
    "message": "Webhook call failed. Error: DEADLINE_EXCEEDED."
  }
}

My simple intent that I've added based on the recommendation that for repeat to work on an intent it must use fulfillment and not based text response in Dialogflow

enter image description here

Here is my index.js file using the inline editor with suggestion to add text response in the config:

const conf = {
  Local: {
    en: {
      Response: {
        "Intent.help": [ 
          "I'm sorry, I'm not able to help you.",
          "You, John, Paul, George, and Ringo ey?"
        ],
        "Action.multivocal.repeat": "Let me try again"
      }
    }
  }
};

This line at the end of my index.js seems odd to me, but may be unrelated:

exports.webhook = Multivocal.processFirebaseWebhook;
exports.dialogflowFirebaseFulfillment = Multivocal.processFirebaseWebhook;

Solution

  • It sounds like you're triggering the Fallback Intent. You also need an Intent defined in Dialogflow that has an Action set to "multivocal.repeat". That might look something like this:

    repeat intent

    In the dialogflow directory of the npm package (or on github) you'll find a zip file with this and several other "standard" Intents that you can use with mulivocal.

    Additionally, all the other Intents that you want to be repeated must use fulfillment to send the response (the library doesn't know what might be sent unless it can send it itself). The simplest way to do this is to enable fulfillment on each, and move the text responses from their Dialogflow screens into the configuration under an entry such as "Intent.name" (replacing "name" with the name of the Intent) or "Action.name" if you set an action name for them.

    So your configuration might be something like

    const conf = {
    Local: {
        en: {
          Response: {
            "Intent.welcome": [
              "Hello there!",
              "Welcome to my Action!"
            ],
            "Action.multivocal.repeat": [
              "Let me try again"
            ]
          }
        }
      }
    };