Search code examples
dialogflow-esactions-on-googleapi-aissml

Google Action with SSML rejected for "having HTML tags"


I submitted my first Action on Google last week.

I have written the code using Dialogflow and WebhookClient, and targeted 2 languages - English and Hindi.

My Action was approved for English, but got back a "denied" status for Hindi with the review "ऐप प्रतिक्रियाओं में एचटीएमएल टैग हैं |" ("App responses have HTML tags")

I have 2 related questions regarding this review -

  1. I am using ssml that I learnt from the following reference material -

And it seems, I am exactly following the documents.

My code looks something like this -

function repeatWord(agent) {
    let sessionContext = agent.getContext(KEY_SESSION);
    let sessionParams = sessionContext.parameters;

    let currentWord = 
              sessionParams.words[sessionParams.currentIndexPosition];
    let ssml;

    if(sessionParams.userLang === 'hi'){
        ssml = `<speak>\n ठीक है। शब्द <sub alias = 
              '${currentWord[KEY_PRONOUNCE]}'>${currentWord[KEY_WORD]} 
              </sub> है।
              <break time='500ms'/>\n  हिंदी में, इसका मतलब होगा 
              ${currentWord[KEY_MEANING]} । </speak>` ;
        agent.add(new Suggestion('अगला शब्द'));
        agent.add(new Suggestion('दोहराना'));
     } else {
        ssml = `<speak>\n Ok! Let's do this again.
                \n The word is <sub alias = 
              '${currentWord[KEY_PRONOUNCE]}'>${currentWord[KEY_WORD]} 
               .</sub>
              <break time='500ms'/>\n In English, it would mean 
              ${currentWord[KEY_MEANING]} .</speak>` ;
        agent.add(new Suggestion('next word'));
        agent.add(new Suggestion('repeat'));
     }
     agent.add(ssml);
   }

Is this the right way to do it?

  1. The example given in review with the rejection is below. But, the example response is the one that was used in Version 1 -

    <speak><p><s>ठीक है। शब्द <sub alias='sthaalikaa'>स्थालिका </sub> है।</s> <s> हिंदी में, इसका मतलब होगा थाली ।</s></p></speak> <speak><p><s> हमारा पहला शब्द आज <sub alias='sthaalikaa'>स्थालिका </sub> है।</s> <s> हिंदी में, इसका मतलब होगा थाली । </s></p></speak>
    

My new response in Version 2 looks like this -

<speak>\n ठीक है। शब्द <sub alias='adhyaapikaa'>अध्यापिका </sub> है।\n      <break time='500ms'/>\n  हिंदी में, इसका मतलब होगा शिक्षक (महिला) । </speak>

Is it possible that my Version 1 is getting resubmitted for review? How do I update the version for review? It is working as updated in the simulator.

The Response in simulator is logged as -

{

  "conversationToken": "[\"learn\",\"select-track\",\"session_vars\"]",
  "expectUserResponse": true,
  "expectedInputs": [
    {
      "inputPrompt": {
        "richInitialPrompt": {
          "items": [
            {
              "simpleResponse": {
                "textToSpeech": " ",
                "displayText": " "
              }
            },
            {
              "simpleResponse": {
                "textToSpeech": "<speak>\n ठीक है। शब्द <sub alias='vaatikaa'>वाटिका </sub> है।\n      <break time='500ms'/>\n  हिंदी में, इसका मतलब होगा वाटिका । </speak>",
                "displayText": "<speak>\n ठीक है। शब्द <sub alias='vaatikaa'>वाटिका </sub> है।\n      <break time='500ms'/>\n  हिंदी में, इसका मतलब होगा वाटिका । </speak>"
              }
            }
          ],
          "suggestions": [
            {
              "title": "अगला शब्द"
            },
            {
              "title": "दोहराना"
            }
          ]
        }
      },
      "possibleIntents": [
        {
          "intent": "assistant.intent.action.TEXT"
        },
        {
          "intent": "9c81a50f-4016-42f1-af46-43c5935cfd7a"
        },
        {
          "intent": "720a2df8-c900-43bb-a2bd-bc42ced8661e"
        },
        {
          "intent": "6e209797-e4f1-43aa-bbe6-3ee36bd3b416"
        },
        {
          "intent": "c5b09a55-3b1e-47c8-9500-508adaf5fe87"
        }
      ],
      "speechBiasingHints": [
        "$answer",
        "$track"
      ]
    }
  ],
  "responseMetadata": {
    "status": {
      "message": "Success (200)"
    },
    "queryMatchInfo": {
      "queryMatched": true,
      "intent": "6e209797-e4f1-43aa-bbe6-3ee36bd3b416"
    }
  }
}

Solution

  • It looks like something is odd in the way the displayText is generated from the SSML you're providing. Typically, this should be handled behind the scenes for you, but it sounds like it isn't in this case - possibly because of the character set being used?

    You can work around this by explicitly setting the SSML and the text yourself. So instead of the agent.add(ssml) line, you might build a text variable that contains just the text of what you want shown and add it with something like

    agent.add(new SimpleResponse({
      speech: ssml,
      text:   text
    }));