After buying an Amazon Echo Dot  (Alexa) last year I have been very impressed with it, so much so that I now own 6 of them and am considering buying more. I've been itching to have a go at creating some custom skills and making her do things that will help me and the family. For my very first adventure in to the world of custom Alexa skills I decided to try and solve the problem of communicating with the kids on the top floor of our 3 storey house. Instead of yelling up the stairs "Tea is ready" I wanted to be able to say "Alexa tell the kids tea is ready", or "Alexa tell Kile to remember to do his homework". The idea being she could then send a notification to the kids PCs or the Xbox with the message. In this article we will look at talking to Windows 10. I will create another article covering the Xbox side of things later.

I created a basic skill, gave it a trigger name of Kile and then added this in the Interaction Model section:

{
  "intents": [
    {
      "slots": [
        {
          "name": "notification",
          "type": "NOTIFICATION"
        }
      ],
      "intent": "NotificationIntent"
    },
    {
      "intent": "AMAZON.StopIntent"
    }
  ]
}

 

In the Custom Slot Types section I added a slot for:

NOTIFICATION any text can go in here

 

Then in the Sample Utterances I added this:

NotificationIntent {notification}

 

I still don't fully understand the Custom Slots because you can put anything in where "any text can go in here" is and it works exactly the same no matter what you say. I'm sure I'll understand this more as I get more experience with the skills. Moving on to the Configuration section I chose a custom HTTPS Endpoint and gave it a URL that pointed at my webserver where I planned to make the magic happen. (See Pitfalls section for more info)

Now you should have a tick in the top 4 secitions and you can trigger the below from the Test section in the Skills Portal, or enable the skill on your Echo and then speak to her. What this configuration gets you is a HTTPS POST to your custom URL with some JSON data in the form of your request.

{
  "session": {
    "new": true,
    "sessionId": "SessionId.a15b2831------------------------------------------------------",
    "application": {
      "applicationId": "amzn1.ask.skill.-----------------------------------------------------"
    },
    "attributes": {},
    "user": {
      "userId": "amzn1.ask.account.-----------------------------------------------------"
    }
  },
  "request": {
    "type": "IntentRequest",
    "requestId": "EdwRequestId.4f9b3e28------------------------------------------------------",
    "intent": {
      "name": "NotificationIntent",
      "slots": {
        "notification": {
          "name": "notification",
          "value": "tea is ready"
        }
      }
    },
    "locale": "en-GB",
    "timestamp": "2017-11-02T14:24:01Z"
  },
  "context": {
    "AudioPlayer": {
      "playerActivity": "IDLE"
    },
    "System": {
      "application": {
        "applicationId": "amzn1.ask.skill.40c21e02------------------------------------------------------"
      },
      "user": {
        "userId": "amzn1.ask.account.-----------------------------------------------------"
      },
      "device": {
        "supportedInterfaces": {}
      }
    }
  },
  "version": "1.0"
}

There are a few pieces of information in here but the important part from the above JSON is the Value in the Notification section:

"value": "tea is ready"

These are the words Alexa thinks you spoke after the activation words, in this instance "Alexa tell Kile tea is ready". So you only get the bit after "Alexa tell Kile" and not the whole phrase. It is sometimes hillarious the things she thinks I said but that all adds to her quirkiness! Thats about it for the Amazon side of things the rest of it will be done on the Webserver.

More to come on the Webserver and PC side of things when I have time.