Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Alexa SDK V2基礎講座

chao2suke
October 26, 2018
84

Alexa SDK V2基礎講座

2018/10/26 Alexa Salon vol.3 資料

chao2suke

October 26, 2018
Tweet

More Decks by chao2suke

Transcript

  1. !3 ( ) A I A l e x a

    & V U I / O /
  2. ί ϛ ϡ χ ς Ο [ A l e

    x a S a l o n ] ओ ࠵ A m a z o n ެ ࣜ ϋ ϯ ζ Φ ϯ τ Ϩ ʔ χ ϯ ά ς Ϋ χ Χ ϧ α ϙ ʔ τ A m a z o n ެ ࣜ τ Ϩ ʔ χ ϯ άϖ ʔ δ ੍ ࡞ A l e x a S k i l l A w a r d s ެ ࣜ ϋ ο Χ ι ϯ : ς Ϋ χ Χ ϧ α ϙ ʔ τ ܾ উ ৹ ࠪ һ ॳ ৺ ऀ ޲ ͚ A l e x a ຊ ࣥ ච !4
  3. Agenda • • S k i l l B u

    i l d e r • • H a n d l e r • R e s p o n s e B u i l d e r • A t t r i b u t e M a n a g e r 5
  4. 6

  5. Hello World 7 const MyHandler = { canHandle(handlerInput) { return

    true; }, handle(handlerInput) { return handlerInput.responseBuilder .speak('͜Μʹͪ͸') .getResponse(); } };
  6. 8

  7. 9

  8. 10

  9. Skill Instance 13 const skillBuilder = Alexa.SkillBuilders.custom(); exports.handler = skillBuilder

    .addRequestHandlers( LaunchRequestHandler, HelpIntentHandler, CancelAndStopIntentHandler, SessionEndedRequestHandler ) .addErrorHandlers(ErrorHandler) .lambda();
  10. Skill Instance 14 const skillBuilder = Alexa.SkillBuilders.custom(); exports.handler = skillBuilder

    .addRequestHandlers( LaunchRequestHandler, HelpIntentHandler, CancelAndStopIntentHandler, SessionEndedRequestHandler ) .addErrorHandlers(ErrorHandler) .lambda(); ͜Εɻ
  11. 19 Skill Builder(Custom) Custom Core 基本機能 Model 定義情報 Dynamodb-persistance-adapter DynamoDBによる永続化

    S3-peresistance-adapter S3による永続化 Api-client AlexaサービスAPIの使⽤
  12. Ex.CustomでDynamoDBを使う 25 'use strict'; const aws = require('aws-sdk-core'); const Adapter

    = require('ask-sdk-dynamodb- persistence-adapter'); コード冒頭でrequired
  13. Ex.CustomでDynamoDBを使う 26 const config = {tableName: 'alexa-salon-vol3', createTable: true}; const

    DynamoDBAdapter = new Adapter.DynamoDbPersistenceAdapter(config); Skill Builderにメソッド追加
  14. Ex.CustomでDynamoDBを使う 27 const skillBuilder = Alexa.SkillBuilders.custom(); exports.handler = skillBuilder .addRequestHandlers(

    LaunchRequestHandler, ) .withPersistenceAdapter(DynamoDBAdapter) .addErrorHandlers(ErrorHandler) .lambda(); Skill Builderにメソッド追加
  15. 32 CanHandle Tips Handler CanHandle exports.handler = skillBuilder .addRequestHandlers( LaunchRequestHandler,

    OrderProgressIntentHandler, OrderCompletedIntentHandler, HelpIntentHandler, CancelAndStopIntentHandler, SessionEndedRequestHandler )
  16. Response Builder 42 発話系 speak/response カード系 withXXXcard Dialog Model系 delegate/ElicitXXX/addConfirmXXX

    AudioPlayer系 addAudioPlayerXXX Display系 addRenderTemplateDirective Video系 addVideoAppLaunchDirective セッション管理系 withShouldEndSession
  17. 52