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

Node.jsと Serverless Frameworkではじめる Alexa Skills...

Node.jsと Serverless Frameworkではじめる Alexa Skills作成入門/ JAWS Festa 2017

Hidetaka Okamoto

November 04, 2017
Tweet

More Decks by Hidetaka Okamoto

Other Decks in Technology

Transcript

  1. N o d e . j s ͱ S e

    r v e r l e s s F r a m e w o r k Ͱ ͸ ͡ Ί Δ A l e x a S k i l l s ࡞ ੒ ೖ ໳ J A W S F e s t a 2 0 1 7
  2. H i d e t a k a O k

    a m o t o • Digitalcube Co. Ltd. • WordCamp Kyoto 2017࣮ߦҕһ௕ • React / ASK / WordPress / CloudFormation
  3. ࠓ ೔ ͷ ࿩ • Amazon Alexaͬͯʁ • ҙ֎ͱ؆୯ʹ࡞ΕΔԻ੠UI •

    Serverless FrameworkͱNode.jsͰAlexa SkillΛ࡞੒ɾӡ༻͢Δ
  4. A l e x a S k i l l

    s • Skill = AlexaͰ࢖͑ΔΞϓϦέʔγϣϯ • amazon.comʹܝࡌՄೳ • χϡʔεϦʔμʔ΍ΫΠζetc… • ཁdeveloperΞΧ΢ϯτ https://amimoto-ami.com/amimoto-ninja/ https://www.amazon.com/Daily-New-York-Times/dp/B01MY9B5BB/ https://www.amazon.com/Digitalcube-Inc-Shifter-man/dp/B07572D7N8/
  5. A u d i o C a p t u

    re A u d i o P l a y b a c k C a l l w e b A P I Ta l k s o m t h i n g R e s p o n c e S p e e c h t o Te x t Te x t t o S p e e c h
  6. A u d i o C a p t u

    re A u d i o P l a y b a c k C a l l w e b A P I Ta l k s o m t h i n g R e s p o n c e S p e e c h t o Te x t Te x t t o S p e e c h A l e x a S k i l l s K i t
  7. A u d i o C a p t u

    re A u d i o P l a y b a c k C a l l w e b A P I Ta l k s o m t h i n g R e s p o n c e S p e e c h t o Te x t Te x t t o S p e e c h AW S L a m b d a w e b A P I A l e x a S k i l l s K i t
  8. A u d i o C a p t u

    re A u d i o P l a y b a c k C a l l w e b A P I Ta l k s o m t h i n g R e s p o n c e S p e e c h t o Te x t Te x t t o S p e e c h ؤ ு Δ ͷ ͸ ͜ ͜ ͩ ͚ A l e x a S k i l l s K i t
  9. [ ج ຊ ] A l e x a S

    k i l l ͸ J S O N Λ ड ͚ औ ͬͯ J S O N Λ ฦ ͢ { " v e r s i o n " : " 1 . 0 " , " s e s s i o n " : { } , " c o n t e x t " : { " S y s t e m " : { " d e v i c e " : { } , " a p p l i c a t i o n " : { } , " u s e r " : { } , " a p i E n d p o i n t " : " h t t p s : / / a p i . a m a z o n a l e x a . c o m " } , } , " re q u e s t " : { " t y p e " : " I n t e n t R e q u e s t " , " re q u e s t I d " : " s t r i n g " , " t i m e s t a m p " : " s t r i n g " , " d i a l o g S t a t e " : " s t r i n g " , " l o c a l e " : " s t r i n g " , " i n t e n t " : { } }
  10. [ ج ຊ ] A l e x a S

    k i l l ͸ J S O N Λ ड ͚ औ ͬͯ J S O N Λ ฦ ͢ { " v e r s i o n " : " s t r i n g " , " re s p o n s e " : { " o u t p u t S p e e c h " : { " t y p e " : " s t r i n g " , " t e x t " : " s t r i n g " , " s s m l " : " s t r i n g " } , " c a rd " : { " t y p e " : " s t r i n g " , " i m a g e " : { " s m a l l I m a g e U r l " : " s t r i n g " , " l a rg e I m a g e U r l " : " s t r i n g " } …
  11. A l e x a S k i l l

    s K i t S D K f o r N o d e . j s • ݱࡏެࣜϦϦʔε͞Ε͍ͯΔ།ҰͷSDK • npm͔ΒΠϯετʔϧͰ͖Δ • αϯϓϧίʔυ΋୔ࢁ • ShowରԠͳͲ΋ https://github.com/alexa/ alexa-skills-kit-sdk-for-nodejs
  12. A l e x a S D K Λ ࢖

    ͏ ( 1 ) - Π ϯε τ ʔ ϧ $ n p m i n i t - y $ n p m i n s t a l l — s a v e a l e x a - s d k
  13. A l e x a S D K Λ ࢖

    ͏ ' u s e s t r i c t ' ; c o n s t A l e x a = re q u i re ( ' a l e x a - s d k ' ) ; m o d u l e . e x p o r t s . h e l l o = ( e v e n t , c o n t e x t , c a l l b a c k ) = > { c o n s t a l e x a = A l e x a . h a n d l e r ( e v e n t , c o n t e x t , c a l l b a c k ) ; a l e x a . re g i s t e r H a n d l e r s ( h a n d l e r s ) ; a l e x a . e x e c u t e ( ) ; } ;
  14. A l e x a S D K Λ ࢖

    ͏ ' u s e s t r i c t ' ; c o n s t A l e x a = re q u i re ( ' a l e x a - s d k ' ) ; m o d u l e . e x p o r t s . h e l l o = ( e v e n t , c o n t e x t , c a l l b a c k ) = > { c o n s t a l e x a = A l e x a . h a n d l e r ( e v e n t , c o n t e x t , c a l l b a c k ) ; a l e x a . re g i s t e r H a n d l e r s ( h a n d l e r s ) ; a l e x a . e x e c u t e ( ) ; } ; S D K ͷ ಡ Έ ࠐ Έ ϋ ϯ υ ϥ ͷ η ο τΞ οϓ ϋ ϯ υ ϥ ͷ ઃ ఆ ࣮ ߦ
  15. Πϕ ϯ τϋ ϯ υ ϥ ͸ O b j

    e c t ܗ ࣜ Ͱ v a r h a n d l e r s = { ' L a u n c h R e q u e s t ' : f u n c t i o n ( ) { t h i s . e m i t ( ' : t e l l ' , ' H e l l o ' ) ; } , } , ' N a m e I n t e n t ' : f u n c t i o n ( ) { c o n s t s l o t s = t h i s . e v e n t . re q u e s t . i n t e n t . s l o t s ; c o n s t n a m e Va l u e = s l o t s . N a m e S l o t . v a l u e ; t h i s . e m i t ( ' : t e l l ' , ` N i c e t o m e e t y o u , $ { n a m e Va l u e } . E n j o y A l e x a w o r l d ! ` ) ; } , } ; I N T E N T ໊ Λ Ω ʔ ʹ ͢ Δ S L O T ͷ ৘ ใ Λ औ ಘ ͢ Δ t h i s . e m i t ʹ Ϩε ϙ ϯε ͳ Ͳ Λ ॻ ͘
  16. ஌ ͬͯ ͓ ͖ ͨ ͍ A l e x

    a S k i l l ༻ ޠ • Intent: Alexaʹ࿩͔͚ͨ͠಺༰ͷ෼ྨ݁Ռ • Slot:ɹAlexaʹ࿩͔͚ͨ͠಺༰ͷม਺෦෼
  17. A l e x a , ࠓ ೔ ͷ ೔

    ຊ γ Ϧ ʔζ ͷ ݁ Ռ Λ ڭ ͑ͯ • <໺ٿͷ݁Ռݕࡧ> {೔෇}ͷ{ର৅ήʔϜ}ͷ݁ՌΛڭ͑ͯ • Intentɹɹɹɹɹˠɹ<໺ٿͷ݁Ռݕࡧ> • ೔෇Slotɹɹɹɹˠɹࠓ೔ • ର৅ήʔϜSlotɹˠɹ೔ຊγϦʔζ http://dev.classmethod.jp/cloud/summary-about-built-in-intent-and-built-in-slot-type/
  18. I n t e n t ຖ ʹ h a

    n d l e r s ͱ ͯ͠ ొ ࿥ ͢ Δ v a r h a n d l e r s = { ' L a u n c h R e q u e s t ' : f u n c t i o n ( ) { t h i s . e m i t ( ' : t e l l ' , ' H e l l o ' ) ; } , } , ' N a m e I n t e n t ' : f u n c t i o n ( ) { c o n s t s l o t s = t h i s . e v e n t . re q u e s t . i n t e n t . s l o t s ; c o n s t n a m e Va l u e = s l o t s . N a m e S l o t . v a l u e ; t h i s . e m i t ( ' : t e l l ' , ` N i c e t o m e e t y o u , $ { n a m e Va l u e } . E n j o y A l e x a w o r l d ! ` ) ; } , } ; I N T E N T ໊ Λ Ω ʔ ʹ ͢ Δ S L O T ͷ ৘ ใ Λ औ ಘ ͢ Δ t h i s . e m i t ʹ Ϩε ϙ ϯε ͳ Ͳ Λ ॻ ͘
  19. Tr y E x a m p l e s

    ! • αϯϓϧεΩϧ͸શͯηοτΞοϓΨΠυ෇͖ • εΫγϣ΋͋ΔͷͰӳޠۤखͰ΋҆৺ • ࡞Γ͍ͨεΩϧͷαϯϓϧΛϕʔεʹ ɹσʔλΛॻ͖׵͑ͯ ɹࣗ෼ͷεΩϧʹ͠Α͏ʂ http://bit.ly/2vSAZhB
  20. S e r v e r l e s s

    F r a m e w o r k ͱ N o d e . j s Ͱ A l e x a S k i l l Λ ࡞ ੒ ɾ ӡ ༻ ͢ Δ
  21. S e r v e r l e s s

    F r a m e w o r k h t t p s : / / s e r v e r l e s s . c o m
  22. S e r v e r l e s s

    F r a m e w o r k • Node.js੡ͷServerlessΞϓϦέʔγϣϯͷσϓϩΠɾ؅ཧπʔϧ • AWSɾGCPɾAzureɾIBMͷෳ਺ϓϥοτϑΥʔϜରԠ • YAMLܗࣜͰϦιʔεΛఆٛ͢ΔͷͰɺߏ੒؅ཧ͕؆୯
  23. S e r v e r l e s s

    F r a m e w o r k Λ ಋ ೖ ͢ Δ $ n p m i n s t a l l - g s e r v e r l e s s $ c d / PAT H / T O / Y O U R / A P P $ s l s c re a t e - t a w s - n o d e j s $ s l s d e p l o y
  24. σΟ Ϩ Ϋ τ Ϧ ߏ ଄ $ t re

    e - L 1 . ᵓ ᴷ ᴷ h a n d l e r. j s ᵓ ᴷ ᴷ n o d e _ m o d u l e s ᵓ ᴷ ᴷ p a c k a g e . j s o n ᵋ ᴷ ᴷ s e r v e r l e s s . y m l
  25. s e r v e r l e s s

    . y m l s e r v i c e : n o d e - a l e x a - t d d - e x a m p l e f r a m e w o r k Ve r s i o n : " > = 1 . 1 0 . 1 " p ro v i d e r : n a m e : a w s r u n t i m e : n o d e j s 6 . 1 0 re g i o n : u s - e a s t - 1 p a c k a g e : i n c l u d e : - n o d e _ m o d u l e s / f u n c t i o n s : h e l l o : h a n d l e r : h a n d l e r. h e l l o e v e n t s : - a l e x a S k i l l
  26. s e r v e r l e s s

    . y m l - 1 s e r v i c e : n o d e - a l e x a - t d d - e x a m p l e f r a m e w o r k Ve r s i o n : " > = 1 . 1 0 . 1 " ϓ ϩ δΣ Ϋ τ ໊ S E R V E R L E S S ͷ όʔ δ ϣ ϯ
  27. s e r v e r l e s s

    . y m l - 2 p ro v i d e r : n a m e : a w s r u n t i m e : n o d e j s 6 . 1 0 re g i o n : u s - e a s t - 1 ར ༻ ͢ Δ Ϋ ϥ ΢ υ ϥϯ λ ΠϜ σ ϓ ϩ Π ઌ
  28. s e r v e r l e s s

    . y m l - 3 p a c k a g e : i n c l u d e : - n o d e _ m o d u l e s / ಉ ࠝ ͢ Δ σΟ Ϩ Ϋ τ Ϧ
  29. s e r v e r l e s s

    . y m l - 4 f u n c t i o n s : h e l l o : h a n d l e r : h a n d l e r. h e l l o e v e n t s : - a l e x a S k i l l L A M B D A ͷ Πϕ ϯ τ Λ A S K ʹ ࣮ ߦ ͢ Δ ؔ ਺ ໊ ϑ Ν ϯ Ϋ γ ϣ ϯ ໊
  30. S e r v e r l e s s

    F r a m e w o r k Ͱ σ ϓ ϩ Π ΍ ಈ ࡞ ֬ ೝ ͢ Δ # ຊ ൪ ༻ ͷ σ ϓ ϩ Π $ s l s d e p l o y — s t a g e p ro d u c t i o n # ݸ ਓ Ξ Χ ΢ ϯ τ ʹ σ ϓ ϩ Π $ s l s d e p l o y — s t a g e d e v e l o p m e n t — p ro f i l e m y l o c a l # ϩ ʔΧ ϧ Ͱ ͷ ಈ ࡞ ֬ ೝ $ s l s i n v o k e l o c a l - f h e l l o
  31. ࣮ ࡍ ʹ S k i l l Λ ެ

    ։ ͠ ͨ ྫ h t t p s : / / w w w. a m a z o n . c o m / D i g i t a l c u b e - I n c - S h i f t e r- m a n / #getshifter
  32. A l e x a S k i l l

    ެ ։ ɾ ӡ ༻ Ͱ ײ ͡ ͨ ͜ ͱ • Example͕༏ल • Update͸গͳ͘ͱ΋̎ύλʔϯ • Serverless FWͷstage͕ศར • ೔ຊޠ͸΋͏ͪΐ͍զຫ
  33. A l e x a S k i l l

    ެ ։ ɾ ӡ ༻ Ͱ ײ ͡ ͨ ͜ ͱ • Example͕༏ल • Update͸গͳ͘ͱ΋̎ύλʔϯ • Serverless FWͷstage͕ศར • ೔ຊޠ͸΋͏ͪΐ͍զຫ
  34. g i t h u b . c o m

    / a l e x a ͸ ΋ ͬ ͱ ஌ Β Ε Δ ΂ ͖ • ̍̌छྨۙ͘ͷαϯϓϧεΩϧ͕ެ։ࡁΈ • ίʔυʹ͸ίϝϯτͰώϯτ͕͋Δ • ηοτΞοϓΨΠυ෇͖ • ϢχοτςετͳͲ΋ • ΈΜͳελʔ෇͚Α͏ http://bit.ly/2vSAZhB
  35. h t t p s : / / g i

    t h u b . c o m / a l e x a / s k i l l - s a m p l e - n o d e j s - q u i z - g a m e / b l o b / m a s t e r / s rc / i n d e x . j s ʮ͜͜Λॻ͖׵͑Ζʯͱ͍͏ίϝϯτ͕͍͍ͭͯΔ
  36. A l e x a S k i l l

    ެ ։ ɾ ӡ ༻ Ͱ ײ ͡ ͨ ͜ ͱ • Example͕༏ल • Update͸গͳ͘ͱ΋̎ύλʔϯ • Serverless FWͷstage͕ศར • ೔ຊޠ͸΋͏ͪΐ͍զຫ
  37. AW S L a m b d a ͷ A

    R N ͔ A P I U R L Λ ࢦ ఆ ͢ Δ
  38. L i v e ͷ S k i l l

    ͸ ” d e v e l o p m e n t ” Ϟ ʔ υ Ͱ ࡞ ۀ
  39. A R N ΍ U R L ɾ I n

    t e n t ͳ Ͳ Λ ߋ ৽ “ S u b m i t f o r C e r t i f i c a t i o n ” Ͱ Ϩ Ϗϡ ʔ ґ པ
  40. ࢦ ఆ ͠ ͨ L a m b d a

    ͷ Ξ οϓ σ ʔ τ ͸ ʢ ࠓ ͷ ॴ ʣ ਃ ੥ ෆ ཁ
  41. S k i l l ͷ U p d a

    t e ʹ ͭ ͍ͯ ʢ ࢲ ݟ ʣ • Intent΍SlotͳͲͷΠϯλϥΫγϣϯͷมߋͷ༗ແͰ൑அ • ιʔεͷߋ৽͚ͩͳΒLambda΍APIόοΫΤϯυΛߋ৽͢Δ͚ͩ • ΠϯλϥΫγϣϯͷมߋ࣌͸Amazonʹਃ੥͕ඞཁ • Echo ShowରԠ΍ݴޠ௥ՃͳͲ΋ཁਃ੥
  42. A l e x a S k i l l

    ެ ։ ɾ ӡ ༻ Ͱ ײ ͡ ͨ ͜ ͱ • Example͕༏ल • Update͸গͳ͘ͱ΋̎ύλʔϯ • Serverless FWͷstage͕ศར • ೔ຊޠ͸΋͏ͪΐ͍զຫ
  43. AW S L a m b d a ͷ A

    R N ͔ A P I U R L Λ ࢦ ఆ ͢ Δ
  44. ߋ ৽ ຖ ʹ ৽ ͠ ͍ L a m

    b d a Λ σ ϓ ϩ Π ͢ Δ ඞ ཁ ͕ ͋ Δ
  45. s t a g e = v e r s

    i o n ʹ ͢ Δ ͱ Θ ͔ Γ ΍ ͢ ͍ # s t a g e ʹ όʔ δ ϣ ϯ ໊ Λ ࢦ ఆ $ s l s d e p l o y — s t a g e v 1 - 1 - 0 # ߋ ৽ ͕ ऴ Θ Ε ͹ ݹ ͍ όʔ δ ϣ ϯ Λ ࡟ আ $ s l s re m o v e — s t a g e v 1 - 0 - 0
  46. A l e x a S k i l l

    ެ ։ ɾ ӡ ༻ Ͱ ײ ͡ ͨ ͜ ͱ • Example͕༏ल • Update͸গͳ͘ͱ΋̎ύλʔϯ • Serverless FWͷstage͕ศར • ೔ຊޠ͸΋͏ͪΐ͍զຫ
  47. ӳ ޠ ɾ υ Π π ޠ Ҏ ֎ ͸

    Ϩ Ϗϡ ʔ Ͱ ஄ ͔ Ε Δ ( 2 0 1 7 / 1 0 ࣌ ఺ ) Issue with the feed “AMIMOTO News”: What went wrong? All feed content must be presented in a language currently supported by Alexa. The current supported languages are English and German. Note: Please note that the home card and the URL is displaying in Japanese language. What to do next. Please refer to our documentation for more information.
  48. ४ උ ͩ ͚ ͯ͠ ਃ ੥ ͸ ͪ ΐ

    ͬ ͱ զ ຫ https://amazon-press.jp/Top-Navi/Press-releases/Presselist/Press-release/amazon/jp/Devices/2017/Amazon-Alexa-1002/
  49. S h i f t e r m a n

    S k i l l ͸ O S S h t t p s : / / g i t h u b . c o m / g e t s h i f t e r / a l e x a - s h i f t e r m a n #getshifter
  50. A W S L a m b d a +

    A l e x a S k i l l s K i t ͷ T i p s
  51. AW S L a m b d a + A

    l e x a S k i l l s K i t ͷ T i p s • sls invoke localͰͷϩʔΧϧςετ • mocha + power-assertΛ࢖ͬͨϢχοτςετ • alexa-sdkͰͷଟݴޠରԠ
  52. AW S L a m b d a + A

    l e x a S k i l l s K i t ͷ T i p s • sls invoke localͰͷϩʔΧϧςετ • mocha + power-assertΛ࢖ͬͨϢχοτςετ • alexa-sdkͰͷଟݴޠରԠ
  53. A l e x a S k i l l

    ͔ Β ͘Δ e v e n t ͷ ߏ ଄ α ϯ ϓϧ { " v e r s i o n " : " 1 . 0 " , " s e s s i o n " : { } , " c o n t e x t " : { } , " re q u e s t " : { } }
  54. D o c u m e n t ʹ e

    v e n t ͷ α ϯ ϓϧ ͋ Γ 㽂 h t t p s : / / d e v e l o p e r. a m a z o n . c o m / d o c s / c u s t o m - s k i l l s / re q u e s t - a n d - re s p o n s e - j s o n - re f e re n c e . h t m l
  55. e v e n t ͷ ஋ Λ - d

    Ͱ ౉ ͤ ͹ ϩ ʔ Χ ϧ Ͱ i n v o k e Ͱ ͖ Δ $ s l s i n v o k e l o c a l - f f u n c t i o n N a m e - d ' { " v e r s i o n " : " 1 . 0 " , " s e s s i o n " : { … } , " c o n t e x t " : { … } , " re q u e s t " : { … } } ’
  56. AW S L a m b d a + A

    l e x a S k i l l s K i t ͷ T i p s • sls invoke localͰͷϩʔΧϧςετ • mocha + power-assertΛ࢖ͬͨϢχοτςετ • alexa-sdkͰͷଟݴޠରԠ #getshifter
  57. γ ϯ ϓϧ ͳ L a m b d a

    ϑ Ν ϯ Ϋ γ ϣ ϯ c o n s t h a n d l e r s = { ' L a u n c h R e q u e s t ' : f u n c t i o n ( ) { t h i s . e m i t ( ‘ : t e l ’ , ' H e l l o A l e x a ' ) } , } ; e x p o r t s . h a n d l e r = f u n c t i o n ( e v e n t , c o n t e x t , c a l l b a c k ) { c o n s t a l e x a = A l e x a . h a n d l e r ( e v e n t , c o n t e x t ) ; a l e x a . re g i s t e r H a n d l e r s ( h a n d l e r s ) ; a l e x a . e x e c u t e ( ) ; } ;
  58. Ϧ Ϋ Τ ε τ ͕ ੒ ޭ ͢ Δ

    ͔ ͷ ςε τ c o n s t a s s e r t = re q u i re ( ' a s s e r t ' ) c o n s t e v e n t = re q u i re ( ' . / e v e n t s / b a s e ' ) c o n s t f u n c = re q u i re ( ‘ . . / s rc / i n d e x . j s ’ ) e v e n t . re q u e s t = { " t y p e " : " L a u n c h R e q u e s t " , " re q u e s t I d " : " re q u e s t 5 6 7 8 " , } c o n s t c a l l b a c k = ( ) = > c o n s o l e . l o g ( ) d e s c r i b e ( ' Te s t A l e x a f u n c t i o n ' , ( ) = > { i t ( ' s h o u l d b e s u c c e e d ' , ( ) = > { f u n c . h a n d l e r ( e v e n t , { s u c c e e d : ( d a t a ) = > a s s e r t . o k ( t r u e ) , f a i l : ( e r r ) = > a s s e r t . o k ( f a l s e ) } , c a l l b a c k ) } ) } )
  59. a l e x a - s d k Ͱ

    Ϣ χ ο τ ςε τ ͢ Δ ࡍ ͷ ϙΠ ϯ τ • callback͸࢖Θͳ͍ • context.succeedͱcontext.failʹ݁Ռ͕ೖΔ • eventͷ஋Λม͑ͭͭɺcontextͷதͰassert͢Δͷ͕ଟ෼ϕετ
  60. AW S L a m b d a + A

    l e x a S k i l l s K i t ͷ T i p s • sls invoke localͰͷϩʔΧϧςετ • mocha + power-assertΛ࢖ͬͨϢχοτςετ • alexa-sdkͰͷଟݴޠରԠ
  61. γ ϯ ϓϧ ͳ L a m b d a

    ϑ Ν ϯ Ϋ γ ϣ ϯ c o n s t h a n d l e r s = { ' L a u n c h R e q u e s t ' : f u n c t i o n ( ) { t h i s . e m i t ( ‘ : t e l ’ , ' H e l l o A l e x a ' ) } , } ; e x p o r t s . h a n d l e r = f u n c t i o n ( e v e n t , c o n t e x t , c a l l b a c k ) { c o n s t a l e x a = A l e x a . h a n d l e r ( e v e n t , c o n t e x t ) ; a l e x a . re g i s t e r H a n d l e r s ( h a n d l e r s ) ; a l e x a . e x e c u t e ( ) ; } ;
  62. ӳ ޠ ͱ υ Π π ޠ ʹ ର Ԡ

    ͠ ͨ ൛ c o n s t l a n g u a g e S t r i n g s = { ' e n ' : { ' t r a n s l a t i o n ' : { ' W E L C O M E ' : ' H e l l o A l e x a ' } } , ' d e - D E ' : { ' t r a n s l a t i o n ' : { ' W E L C O M E ' : " H a l l o A l e x a " } } } ; c o n s t h a n d l e r s = { ' L a u n c h R e q u e s t ' : f u n c t i o n ( ) { t h i s . e m i t ( ‘ : t e l ’ , t h i s . t ( ‘ W E L C O M E ' ) ) } , } ; e x p o r t s . h a n d l e r = f u n c t i o n ( e v e n t , c o n t e x t , c a l l b a c k ) { c o n s t a l e x a = A l e x a . h a n d l e r ( e v e n t , c o n t e x t ) ; a l e x a . re s o u rc e s = l a n g u a g e S t r i n g s ; a l e x a . re g i s t e r H a n d l e r s ( h a n d l e r s ) ; a l e x a . e x e c u t e ( ) ; } ;
  63. e v e n t . re q u e

    s t . l o c a l e ʹ ஋ Λ ೖ Ε Δ ͜ ͱ Ͱ ςε τ Մ ೳ c o n s t a s s e r t = re q u i re ( ' a s s e r t ' ) c o n s t e v e n t = re q u i re ( ' . / e v e n t s / b a s e ' ) c o n s t f u n c = re q u i re ( ‘ . . / s rc / i n d e x . j s ’ ) e v e n t . re q u e s t = { " t y p e " : " L a u n c h R e q u e s t " , " re q u e s t I d " : " re q u e s t 5 6 7 8 " , } c o n s t c a l l b a c k = ( ) = > c o n s o l e . l o g ( ) d e s c r i b e ( ' Te s t A l e x a f u n c t i o n ' , ( ) = > { i t ( ' s h o u l d b e s u c c e e d ' , ( ) = > { e v e n t . re q u e s t . l o c a l e = " e n - U S " f u n c . h a n d l e r ( e v e n t , { s u c c e e d : ( d a t a ) = > a s s e r t . o k ( t r u e ) , f a i l : ( e r r ) = > a s s e r t . o k ( f a l s e ) } , c a l l b a c k ) } ) } )
  64. h t t p s : / / d e

    v e l o p e r. a m a z o n . c o m / d o c s / c u s t o m - s k i l l s / h o s t - a - c u s t o m - s k i l l - a s - a n - a w s - l a m b d a - f u n c t i o n . h t m l “Note: Lambda functions for Alexa skills can be hosted in either the US East (N. Virginia) or EU (Ireland) region. These are the only regions the Alexa Skills Kit supports.” L a m b d a ͷ σ ϓ ϩ Π ઌ ͸ u s - e a s t - 1 ͔ e u - w e s t - 1
  65. ࠓ ೔ ͷ ࿩ • Amazon Alexaͱ͸ʁ • ҙ֎ͱ؆୯ʹ࡞ΕΔԻ੠UI •

    Serverless FrameworkͱNode.jsͰAlexa SkillΛ࡞੒ɾӡ༻͢Δ • Alexa͸͍͍ͧ
  66. 2 0 1 8 / 2 / 1 1 A

    l e x a D a y s i n ਆ ށ h t t p s : / / a l e x a d a y 2 0 1 8 . j a w s - u g . j p /
  67. ࠓ ͳ Β 5 0 0 ԁ ͓ ಘ h

    t t p s : / / a l e x a d a y 2 0 1 8 . j a w s - u g . j p /