Search code examples
dialogflow-esalexa-skills-kit

Why does Alexa SDK throw an error when migrating from Dialogflow


I'm trying to migrate my action form Dialogflow, and the most important thing is the intent schema. But after uploading the .json file, the error Intent name must not be empty. Error code: MissingIntentName is thrown. Here is Intent schema.json

 {
"intents": [
{
  "intent": "SelectedSubjectsYes"
},
{
  "intent": "UserIsOk",
  "slots": [
    {
      "name": "okslot",
      "type": "OK"
    }
  ]
},
{
  "intent": "SelectedSubjectsNo"
},
{
  "intent": "UserIsNotOk",
  "slots": [
    {
      "name": "not_okslot",
      "type": "NOT_OK"
    }
  ]
},
{
  "intent": "DefaultWelcomeIntent"
},
{
  "intent": "HowAreYou?"
},
{
  "intent": "SelectedSubjects",
  "slots": [
    {
      "name": "subjectslot",
      "type": "SUBJECT"
    }
  ]
}
]
}

I've in no way edited it, so why the error? Thanks in advance.


Solution

  • The JSON structure for interaction model is sightly different. This is how it should look now.

    {
        "interactionModel": {
            "languageModel": {
                "invocationName": "Your invocation name",
                "intents": [
                    {
                        "name": "SelectedSubjectsYes",
                        "slots": [],
                        "samples": [
                            "provide sample for SelectedSubjectsYes intent",
                            "sample for SelectedSubjectsYes intent"
                        ]
                    },
                    {
                        "name": "UserIsOk",
                        "slots": [
                            {
                                "name": "okslot",
                                "type": "OK"
                            }
                        ],
                        "samples": [
                            "provide other samples for UserIsOk",
                            "I'm {okslot}",
                            "{okslot}"
                        ]
                    },
                    {
                        "name": "SelectedSubjectsNo",
                        "slots": [],
                        "samples": [
                            "provide sample for SelectedSubjectsNo intent",
                            "sample for SelectedSubjectsNo intent"
                        ]
                    },
                    {
                        "name": "UserIsNotOk",
                        "slots": [
                            {
                                "name": "not_okslot",
                                "type": "NOT_OK"
                            }
                        ],
                        "samples": [
                            "provide other samples for UserIsNotOk",
                            "i'm {not_okslot}",
                            "{not_okslot}"
                        ]
                    },
                    {
                        "name": "HowAreYou?",
                        "slots": [],
                        "samples": [
                            "provide sample for HowAreYou intent",
                            "sample for HowAreYou intent"
                        ]
                    },
                    {
                        "name": "SelectedSubjects",
                        "slots": [
                            {
                                "name": "subjectslot",
                                "type": "SUBJECT"
                            }
                        ],
                        "samples": [
                            "provide other samples for SelectedSubjects",
                            "i choose {subjectslot}"
                        ]
                    }
                ],
                "types": [
                    {
                        "name": "OK",
                        "values": [
                            {
                                "name": {
                                    "value": "ok"
                                }
                            },
                            {
                                "name": {
                                    "value": "yes"
                                }
                            }
                        ]
                    },
                    {
                        "name": "NOT_OK",
                        "values": [
                            {
                                "name": {
                                    "value": "not ok"
                                }
                            },
                            {
                                "name": {
                                    "value": "nope"
                                }
                            }
                        ]
                    },
                    {
                        "name": "SUBJECT",
                        "values": [
                            {
                                "name": {
                                    "value": "Physics"
                                }
                            },
                            {
                                "name": {
                                    "value": "Biology"
                                }
                            }
                        ]
                    }
                ]
            }
        }
    }
    

    Rather than converting from Dialog flow, it's pretty easy to design one in Alexa skill builder. Also, it is recommended to use predefined AMAZON.YesIntent and AMAZON.NoIntent for "yes" or "no" utterances.