Integration of SUSI AI to Alexa
An Alexa skill which can be used to ask susi for answers like: "Alexa, ask susi chat who are you" or "Alexa, ask susi chat what is the temperature in berlin". If at any point of time, you are unclear about the code in the blog post, you can check the code of the already made SUSI Alexa skill from the susi_alexa_skill repository. Getting Started : Alexa Susi AI Skill Follow the instructions below: Visit the Amazon developer site and Login. Click Alexa, on the top bar. Click Alexa skills kit. Click on add a new skill button on the top right of the page. We will be at the skill information tab. Write the name of the skill Write the invocation name of the skill i.e. the name that will be used to trigger your skill. Like in our case, if we need to ask anything (as we have 'susi chat' as the invocation name), we will ask with "Alexa, ask susi chat" as a prefix to our question sentence. By clicking next, we will be redirected to the second tab i.e. Interaction model. We need to fill two fields here i.e. intent schema and sample utterances. For intent schema, we need to write all the available intents and the parameters for each of them. Like in our case: { "intents": [ { "slots": [ { "name": "query", "type": "AMAZON.LITERAL" } ], "intent": "callSusiApi" } ] } We have a single intent that is "callSusiApi" and the parameter it accepts is "query" of type "AMAZON.LITERAL" (in simple words, a string type). Parameters are termed as slots here. The different types of slots available, can be seen from here. For sample utterances, we need to tell what utterances by the client will lead to what intent. In our case: We have just one intent and the whole string uttered by the client should be fed to this intent as a "query" slot (parameter). Let's click next now. We will be shifted to the configuration tab. We will be making a lambda function, which will hold the code for our Susi skill, further we need to link that code to this skill. To do the linking we need to get the Amazon resource name i.e. ARN and fill it in the field named endpoint: To get the amazon resource name, in a new tab, visit here. Visit "Lambda" followed by get started button. Click on "Create a lambda function": We need to select a blueprint for our lambda function. Select the "blank function" option for that. Click next. For configure triggers option, click this box and select "Alexa skills kit" option. Click next. In configure function tab, just write the name of the function and its description. Let’s code our lambda function: // basic syntax that should be available in the lambda function var https = require('http'); exports.handler = (event, context) => { try { if (event.session.new) { // New Session console.log("NEW SESSION") } switch (event.request.type) { case "LaunchRequest": //…
