Alexa에서 Skill을 만들어 보자, 그 2
9193 단어 람다AlexaSkillsKit알렉사Node.js
htps : // 이 m/사의 h/있어 ms/26014808186cfd8f95f5
서버와의 협력: 이번에는 Lambda를 사용합니다.
■Setp6:Lambda 작성

콘솔에 로그인합니다.
htps : // 아 ws. 아마존. 이 m/jp/

이 안에 "Lambda"가 있으므로 선택합니다.

의 화면이 나타나면 「함수 작성」을 합니다.

함수의 작성에는 「 설계도」를 선택하면, 아래에 여러가지 나오므로 「Alexa-skill-kit-sdk-factskill」를 선택해 주세요.

이름은 이번에는 잠정적으로 'foodTest01'로 하고 롤은 '기존 롤 선택' 기존 롤은 'lambda_basic_executuin'

아래의 이삭에 「함수 작성」버튼이 있으므로 거기서 작성을 합니다.
■Step7: Alexa Skills Kit 설정

"Alexa Skulls Kit"를 선택하면 트리거 설정이 나타나므로 스킬 ID를 설정합니다.
이 빙빙 ID에 관해서는 다른 브라우저에서 "Alexa에서 Skill을 만들어 보자, 그 1"에서 사용한 Alexa Skills Kit에 액세스합니다.

엔드포인트에서 AWS Lambda의 ARN을 선택하면 이 화면이 되므로 여기에 나타난 스킬 ID를 Lambda로 설정합니다.

"추가"를 눌러 설정할 수 있습니다. 이제 AlexaSkillsKit에서 Lambda로 연결할 수 있습니다.
Lambda에서 AlexaSkillsKit의 연결을 설정합니다.

우선은 「저장」을 한 뒤에 ARN이라고 걸린 부분을 카피합니다.

마지막으로 AlexaSkillsKit의 기본 영역에 ARN 부분을 복사하고 마지막 "엔드포인트 저장"을 누르십시오.
이제 양방향 통신이 가능합니다.
■ Setp8 : Node.js 작성.

"foodTest01"을 선택하면 함수 코드가 나타납니다.
이번에는
'use strict';
var Alexa = require('alexa-sdk');
var APP_ID = undefined;
var handlers = {
'LaunchRequest': function () {
this.emit(':ask', 'どうしましたか', 'どうしましたか');
},
'commandProc': function () {
var food = this.event.request.intent.slots.food.value;
var feel = this.event.request.intent.slots.feel.value;
this.emit(':tell', '私も'+food+'は'+feel+'です');
},
};
exports.handler = function (event, context, callback) {
const alexa = Alexa.handler(event, context, callback);
alexa.APP_ID = APP_ID;
alexa.registerHandlers(handlers);
alexa.execute();
};
합니다.
■Step9:프로그램 테스트

위의 "테스트 이벤트 선택"을 먼저 합니다.

이벤트 템플릿에서 Amazon Alexa Starts Session을 선택
이벤트명은 우선 「StartTest」로서 「작성」버튼을 둡니다.

「테스트」버튼을 두고, 실행 결과:성공이 나오면 OK입니다.
■Step10:동작 확인

AlexaSkillsKit로 돌아가서 테스트를 선택합니다.
그리고 「개발중」으로 설정하는 것으로, 브라우저상에서, Alexa의 테스트를 할 수 있습니다.

처음 '음식을 기동해'라고 입력하고, 스킬을 기동시킨 뒤에 '수박을 좋아합니다'라고 입력하면 Alexa가 '나도 수박은 좋아합니다'라고 바꿔줍니다.
Reference
이 문제에 관하여(Alexa에서 Skill을 만들어 보자, 그 2), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/sanoh/items/e2e9927d3a56c16b070d텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)