A few generic question regarding Skill building


#1

First of all, please take my apology for posting some generic questions here. But these are kind of important and I want to implement this functionality in my skill which I am developing.

In my skill, I want to offer an IVR menu to my users. This is how it looks:

const ivr_menu = [
  {
    id: 1,
    choice: "Contact detail."
  },
  {
    id: 2,
    choice: "Email History."
  },
  {
    id: 3,
    choice: "Bounced Emails."
  },
  {
    id: 4,
    choice: "Email Sent by Contact."
  },
  {
    id: 5,
    choice: "Email viewed by Contact."
  },
  {
    id: 6,
    choice: "Contact groups."
  },
  {
    id: 7,
    choice: "Email activity log."
  }
];

When I am testing the application with JOVO debugger, I can easily select the right Intent button and pass a value from there. But in real time, how would I tell Alexa to navigate to the right intent at the same time with a kind of output?

app.setHandler({
  LAUNCH() {
    return this.toIntent("WelcomeIntent");
  },

  async WelcomeIntent() {
    let os =
      "Welcome to emailer platform. The following IVR menu will guide you through. Please listen carefully. <break strength='medium' />";
    for (var index = 0; index < ivr_menu.length; index++) {
      os += `Say ${ivr_menu[index].id} <break strength='medium' />for ${
        ivr_menu[index].choice
      }. <break strength='strong' />`;
    }

    os += " To repeat this menu say 9.";

    this.ask(os);
  },
 ...
});

The above WelcomeIntent gives user the options to choose from 1 through 7 (the IDs). The question is if I say choose 6 from the IVR the skill should automatically navigate to the associated Intent. But I am not sure if in real time this would happen.

Question 1:
Is there an y option that I can tell Alexa something like this?
this.ask('output-speech', [intent-name]); so that when I SAY a value Alexa already knows which Intent it has to activate?

The above skill has many different intents and Context Switching is not required for now for this skill. It will be a kind of one intent at time. i.e. user will choose another intent only by getting back to WelcomeIntent (the ivr-menu) and entering his/he choice (ID, i.e. 1 through 7).

Here is the model I have for now:

{
  "invocation": "metrics report",
  "intents": [
    {
      "name": "HelloWorldIntent",
      "phrases": ["hello", "say hello", "say hello world"]
    },
    {
      "name": "WelcomeIntent"
    },
    {
      "name": "UserOptionIntent",
      "phrases": ["{option}"],
      "inputs": [
        {
          "name": "option",
          "type": "AMAZON.NUMBER",
          "dialogflow": "@sys.given-name"
        }
      ]
    },
    {
      "name": "BouncedEmailIntent",
      "phrases": ["{emailid}"],
      "inputs": [
        {
          "name": "emailid",
          "type": "AMAZON.NUMBER",
          "dialogflow": "@sys.given-name"
        }
      ]
    },
    {
      "name": "ContactLookupIntent",
      "phrases": [
        "{contactid}",
        "Contact id is {contactid}",
        "I want to know about {contactid}"
      ],
      "inputs": [
        {
          "name": "contactid",
          "type": "AMAZON.NUMBER",
          "dialogflow": "@sys.given-name"
        }
      ]
    },
    {
      "name": "ContactGroupsIntent",
      "phrases": [
        "{contactid}",
        "Contact Id is {contactid}",
        "Which groups {contactid} belongs to",
        "Tell me which groups {contactid} belongs to",
        "I want to know which groups {contactid} is associated to",
        "Tell me the names of the groups which {contactid} belongs to"
      ],
      "inputs": [
        {
          "name": "contactid",
          "type": "AMAZON.NUMBER",
          "dialogflow": "@sys.given-name"
        }
      ]
    },
    {
      "name": "OptionOneIntent",
      "phrases": [],
      "inputs": []
    }
  ],
  "alexa": {
    "interactionModel": {
      "languageModel": {
        "intents": [
          {
            "name": "AMAZON.CancelIntent",
            "samples": []
          },
          {
            "name": "AMAZON.HelpIntent",
            "samples": []
          },
          {
            "name": "AMAZON.StopIntent",
            "samples": []
          }
        ]
      }
    }
  },
  "dialogflow": {
    "intents": [
      {
        "name": "Default Fallback Intent",
        "auto": true,
        "webhookUsed": true,
        "fallbackIntent": true
      },
      {
        "name": "Default Welcome Intent",
        "auto": true,
        "webhookUsed": true,
        "events": [
          {
            "name": "WELCOME"
          }
        ]
      }
    ]
  }
}

Question 2.

The API I am using to fetch data from server uses ID (numeric) for most of its endpoints, which are 6 digit numbers. The easiest way for users to tell those 6-digit numbers to Alexa if it accepts those as cardinal numbers. How can I accomplish this? Alexa has a built-in slot type called AMAZON.NUMBER. But if I say an ID as cardinal number like one five nine zero six six, will that be understood by Alexa when the slot type is AMAZON.NUMBER?

Again, I apologize for such a long question. I am also sorry if this is not well written or organized. Please let me know if I should clarify more.

Eagerly looking forward to your reply.

Regards
Subrata Sarkar


#2

Regarding Question 2:

https://developer.amazon.com/docs/custom-skills/slot-type-reference.html#number

The solttype reference of AMAZON.NUMBER has an example listet where e.g. five nine zero six six is converted to 59066.


#3

Thank you @michaelwapp. Would be great to know about the first one too :slight_smile:


#4

So as far as I can tell your skill does the following?

It asks the user about the possible options (e.g. 1:ContactDetail … to 7:Email activity log) and the user can choose one of thoose options by saying e.g. ‘4’. In case of 4, the a specific Intent should be triggerd?

Is that right?


#5

Yes. You are right. :slight_smile:


#6

In this case, I would create one Intent where I would ‘catch’ all number input. (e.g. user says 4, or number 4 or something like that). After you call this.ask(), the user will provide his choice. The provided answer will be mapped to the ‘catch’ intent in which you could implement your logic and choose the according intent with return this.toIntent('INTENTNAME');.


#7

Thank you! But I did not understand fully.
May I please request you to give me a sample prototype snippet?