1.Alexa技能的开发首先需要一个亚马逊的开发者账号https://developer.amazon.com
<https://developer.amazon.com> 如下进入Amazon Alexa:



 

2.在账号的控制台上“Your Alexa Consoles” --> Skills



3.进入Alexa技能的创建界面 --> "Craete Skills"创建自己的技能:



4.Alexa技能中的Bulid:

    4.1、写入调用名称:



        4.2、Intent中的Add 添加意图名字 -->Sample Utterances 示例语句 ——>Save Model
——>Build Model:



 

5.Endpoint中与lambda函数连接,“Your Sills ID”是创建技能的ID在之后Lambda函数要用到,“

Default Region“是创建Lambda函数的ARN:

 

 



 

6.接下来是需要注册AWS账号 <https://console.aws.amazon.com/>
(需要绑定Visa信用卡),注册完成登录在搜索Lamdba进入lambda函数界面:



7.创建Lambda函数:



 

8.选择蓝图——>搜索栏输入alexa查找到alexa-skill-kit-sdk-factskill的技能模板——>配置:



9.写入名称、选择角色、选择:lambda_basic_execution:



10.添加触发器“Alexa Skills Kit”把步骤5中“Your Sills ID”的值拷贝到技能ID中:



 

11.点击Lambda函数——>导航到函数代码:





12.把上面的函数代码中的index.js代码清除,填入如下代码:
'use strict'; var Alexa = require('alexa-sdk'); var flashcardsDictionary = [
]; var DECK_LENGTH = flashcardsDictionary.length; var handlers = {
//在开发者账号控制台上技能中创建的“Create custom intent”的名字 "myFavoriteLanguageIntent":
function () { this.response.speak("what's my favorite language");
this.emit(':responseReady'); }, //在开发者账号控制台上技能中创建的“Create custom intent”的名字
"HelloHUDIntent": function () { this.response.speak("hello hud");
this.emit(':responseReady'); }, // Open Codecademy Flashcards 'LaunchRequest':
function() { //Lambda函数响应返回语音及文字 this.response.speak("John,how are you");
this.emit(':responseReady'); }, // User gives an answer 'AnswerIntent':
function() { }, // Stop 'AMAZON.StopIntent': function() {
this.response.speak('Ok, let\'s play again soon.');
this.emit(':responseReady'); }, // Cancel 'AMAZON.CancelIntent': function() {
this.response.speak('Ok, let\'s play again soon.');
this.emit(':responseReady'); }, // Save state 'SessionEndedRequest': function()
{ console.log('session ended!'); this.emit(':saveState', true); } };
exports.handler = function(event, context, callback){ var alexa =
Alexa.handler(event, context, callback); alexa.registerHandlers(handlers);
alexa.execute(); };
13.之后保存设置——>拷贝Lambda中ARN:arn:aws:lambda:us-east......



 

14.Lambda的ARN放入步骤5中的“Default Region”中。

15.下一步是控制台上的TEST,输入创建技能时的Invocation Name,到此一个技能创建和测试就完成了:



 

 

 

 

友情链接
ioDraw流程图
API参考文档
OK工具箱
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:637538335
关注微信