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

Alexaスキルで70円稼いだ話 スキル内課金ことはじめ / aajug-okinawa-2...

Alexaスキルで70円稼いだ話 スキル内課金ことはじめ / aajug-okinawa-201907

Hidetaka Okamoto

July 26, 2019
Tweet

More Decks by Hidetaka Okamoto

Other Decks in Programming

Transcript

  1. A l e x a εΩϧ Ͱ 7 0 ԁ

    Ք ͍ ͩ ࿩ εΩϧ ಺ ՝ ۚ ͜ ͱ ͸ ͡ Ί P WA N i g h t O S A K A Ω ο Ϋ Φ ϑ #aajug
  2. H i d e t a k a O k

    a m o t o • Digitalcube Co. Ltd. • Alexa Campions • AWS Samurai 2017 in Japan • ask sdk(Node.js) Core contributor
  3. A l e x a Ͱ ݸ ਓ త ʹ

    ऩ ӹ Λ ্ ͛ ͨ ͜ ͱ ͕ ͋ Δ ਓ #aajug
  4. A l e x a Ͱ ऩ ӹ Λ ͋

    ͛ Δ ํ ๏ • εΩϧ಺՝ۚ(In Skill Purchase) • Amazon Pay • ΞΧ΢ϯτϦϯΫ • Ϧϫʔυ • AlexaϑΝϯυ #aajug
  5. A l e x a Ͱ ऩ ӹ Λ ͋

    ͛ Δ ํ ๏ • εΩϧ಺՝ۚ(In Skill Purchase): σδλϧίϯςϯπ • Amazon Pay • ΞΧ΢ϯτϦϯΫ • Ϧϫʔυ • AlexaϑΝϯυ #aajug
  6. A l e x a Ͱ ऩ ӹ Λ ͋

    ͛ Δ ํ ๏ • εΩϧ಺՝ۚ(In Skill Purchase): σδλϧίϯςϯπ • Amazon Payɹɹɹɹɹɹɹɹɿ෺඼ɾαʔϏε • ΞΧ΢ϯτϦϯΫ • Ϧϫʔυ • AlexaϑΝϯυ #aajug
  7. A l e x a Ͱ ऩ ӹ Λ ͋

    ͛ Δ ํ ๏ • εΩϧ಺՝ۚ(In Skill Purchase): σδλϧίϯςϯπ • Amazon Payɹɹɹɹɹɹɹɹɿ෺඼ɾαʔϏε • ΞΧ΢ϯτϦϯΫɹɹɹɹɹ ɿ࿈ܞઌͰͷ՝ۚʢϚωοΫεͳͲʣ • Ϧϫʔυ • AlexaϑΝϯυ #aajug
  8. A l e x a Ͱ ऩ ӹ Λ ͋

    ͛ Δ ํ ๏ • εΩϧ಺՝ۚ(In Skill Purchase): σδλϧίϯςϯπ • Amazon Payɹɹɹɹɹɹɹɹɿ෺඼ɾαʔϏε • ΞΧ΢ϯτϦϯΫɹɹɹɹɹ ɿ࿈ܞઌͰͷ՝ۚʢϚωοΫεͳͲʣ • Ϧϫʔυɹɹɹɹɹɹɹɹɹ ɿਓؾεΩϧʹର͢Δใ঑ۚ • AlexaϑΝϯυ #aajug
  9. A l e x a Ͱ ऩ ӹ Λ ͋

    ͛ Δ ํ ๏ • εΩϧ಺՝ۚ(In Skill Purchase): σδλϧίϯςϯπ • Amazon Payɹɹɹɹɹɹɹɹɿ෺඼ɾαʔϏε • ΞΧ΢ϯτϦϯΫɹɹɹɹɹ ɿ࿈ܞઌͰͷ՝ۚʢϚωοΫεͳͲʣ • Ϧϫʔυɹɹɹɹɹɹɹɹɹ ɿਓؾεΩϧʹର͢Δใ঑ۚ • AlexaϑΝϯυɹɹɹɹɹɹɹɿ৽͍͠σόΠεɾεΩϧͳͲ΁ͷग़ࢿ #aajug
  10. A l e x a Ͱ ऩ ӹ Λ ͋

    ͛ Δ ํ ๏ • εΩϧ಺՝ۚ(In Skill Purchase): σδλϧίϯςϯπ • Amazon Payɹɹɹɹɹɹɹɹɿ෺඼ɾαʔϏε • ΞΧ΢ϯτϦϯΫɹɹɹɹɹ ɿ࿈ܞઌͰͷ՝ۚʢϚωοΫεͳͲʣ • Ϧϫʔυɹɹɹɹɹɹɹɹɹ ɿਓؾεΩϧʹର͢Δใ঑ۚ • AlexaϑΝϯυɹɹɹɹɹɹɹɿ৽͍͠σόΠεɾεΩϧͳͲ΁ͷग़ࢿ • डୗ։ൃɹɹɹɹɹɹɹɹɹ ɿͰ͢ΑͶ #aajug
  11. ࠓ ೔ ͷ ࿩ •εΩϧ಺՝ۚ(In Skill Purchase) • Amazon Payɹɹɹɹɹɹɹɹɿ෺඼ɾαʔϏε

    • ΞΧ΢ϯτϦϯΫɹɹɹɹɹ ɿ࿈ܞઌͰͷ՝ۚʢϚωοΫεͳͲʣ • Ϧϫʔυɹɹɹɹɹɹɹɹɹ ɿਓؾεΩϧʹର͢Δใ঑ۚ • AlexaϑΝϯυɹɹɹɹɹɹɹɿ৽͍͠σόΠεɾεΩϧͳͲ΁ͷग़ࢿ • डୗ։ൃɹɹɹɹɹɹɹɹɹ ɿͰ͢ΑͶ #aajug
  12. εΩϧ ಺ ՝ ۚ ͱ ͸ • ΧελϜεΩϧ಺ͰσδλϧίϯςϯπΛఏڙͰ͖Δ • ങ͍੾Γ

    / ౎౓ߪೖ / ఆظ՝ۚͷ̏छྨʢ2019/07࣌఺ʣ • US / UK / GE / JPͳͲɺ஍Ҭ͕ݶΒΕΔʢ2019/07࣌఺ʣ • σδλϧίϯςϯπͷΈ • AmazonΞΧ΢ϯτͷܾࡁ৘ใΛར༻ #aajug
  13. εΩϧ ಺ ՝ ۚ ͱ ͸ • ΧελϜεΩϧ಺ͰσδλϧίϯςϯπΛఏڙͰ͖Δ • ങ͍੾Γ

    / ౎౓ߪೖ / ఆظ՝ۚͷ̏छྨʢ2019/07࣌఺ʣ • US / UK / GE / JPͳͲɺ஍Ҭ͕ݶΒΕΔʢ2019/07࣌఺ʣ • σδλϧίϯςϯπͷΈ • AmazonΞΧ΢ϯτͷܾࡁ৘ใΛར༻ #aajug
  14. εΩϧ ͸ Ϣ ʔ β ʔ ͷ ܾ ࡁ ৘

    ใ ʹ Ϧ ʔ ν Ͱ ͖ ͳ ͍ • Θ͔Δ͜ͱ͸ɺܾࡁͷ੒൱΍ߪೖ঎඼ͷ༗ແͳͲ • Skill Connectionʹ͍ۙڍಈ • ܾࡁࣗମ͸ίΞػೳଆͰ࣮ߦ͞ΕΔ • ηΩϡΞʹӡ༻Ͱ͖Δ൓໘ɺCRMతͳ࣮૷͸೉қ౓͕ߴ͍ #aajug
  15. ༨ ஊ ɿ I S P ͷ ͪ ΐ ͬ

    ͱ ಛ घ ͳ ڍ ಈ • ௨ৗͷΧελϜεΩϧͰ͸ɺҰ౓ແޮԽ͢ΔͱUUID͕มΘΔ • UUID: User ID / Device ID • ͨͩ͠ʮফඅܕʯͷ঎඼͕͋ΔεΩϧͰ͸UUID͕มΘΒͳ͍ • εΩϧΛ࠶༗ޮԽͨ͠ࡍσʔλΛ෮چ͍ͨ͠ͳΒϋοΫཁૉ͔΋ #aajug
  16. h t t p s : / / d e

    v e l o p e r. a m a z o n . c o m / j a / d o c s / i n - s k i l l - p u rc h a s e / a d d - i s p s - t o - a - s k i l l . h t m l # m a i n t a i n - i n v e n t o r y “userIdͷಈ࡞͸ɺফඅܕ঎඼Λఏڙ͢ΔεΩϧʹͷΈ ద༻͞ΕΔ͜ͱʹ஫ҙ͍ͯͩ͘͠͞ɻ ফඅܕ঎඼Λఏڙ͠ͳ͍εΩϧ͕ແޮʹ͞Εͨ৔߹͸ɺ Alexa͸userIdΛϦηοτ͠·͢ɻ”
  17. εΩϧ ಺ ՝ ۚ εΩϧ Λ ࡞ Δ ͨ Ί

    ʹ ඞ ཁ ͳ ΋ ͷ • εΩϧ಺՝ۚ঎඼৘ใ • ঎඼৘ใͷऔಘɾߪೖɾΩϟϯηϧ༻ͷΠϯςϯτ • ঎඼໊ͷΧελϜεϩοτ • ্هϦΫΤετΛॲཧ͢ΔͨΊͷϦΫΤετϋϯυϥʔ #aajug
  18. εΩϧ ಺ ՝ ۚ εΩϧ Λ ࡞ Δ ͨ Ί

    ʹ ඞ ཁ ͳ ΋ ͷ • εΩϧ಺՝ۚ঎඼৘ใ • ঎඼৘ใͷऔಘɾߪೖɾΩϟϯηϧ༻ͷΠϯςϯτ • ঎඼໊ͷΧελϜεϩοτ • ্هϦΫΤετΛॲཧ͢ΔͨΊͷϦΫΤετϋϯυϥʔ #aajug
  19. A S K C L I ͔ Β ΋ ઃ

    ఆ Մ ೳ $ ask add isp --isp-name my-example-product # Ͳͷ঎඼λΠϓʹ͢Δ͔ʁ ? List of in-skill product types you can choose (Use arrow keys) › Entitlement Subscription # ςϯϓϨʔτΛͳʹʹ͢Δ͔ʁ ? List of in-skill product templates you can choose (Use arrow keys) › Entitlement_Template In-skill product my-example-product is saved to ./isps/entitlement/my-example-product.json $ ask deploy -t isp
  20. ţ Š Ƅ Ş ū Ŝ Ƅ Ř J S

    O N Ͱ ί ʔ υ ؅ ཧ Մ ೳ
  21. εΩϧ ಺ ՝ ۚ εΩϧ Λ ࡞ Δ ͨ Ί

    ʹ ඞ ཁ ͳ ΋ ͷ • εΩϧ಺՝ۚ঎඼৘ใ • ঎඼৘ใͷऔಘɾߪೖɾΩϟϯηϧ༻ͷΠϯςϯτ • ঎඼໊ͷΧελϜεϩοτ • ্هϦΫΤετΛॲཧ͢ΔͨΊͷϦΫΤετϋϯυϥʔ #aajug
  22. ঎ ඼ ৘ ใ ͷ औ ಘ ɾ ߪ ೖ

    ɾ Ω ϟϯ η ϧ ༻ ͷ Π ϯ ςϯ τ • ϏϧτΠϯΠϯςϯτ͸Ұ੾ͳ͍ • ࣗ෼Ͱ࡞Δ • ͍͍ͩͨࣅͨ಺༰ʹͳΔͷͰɺεχϖοτԽ͓ͯ͘͠ͱศར • ΩϟϯηϧܥΛߴ֬཰Ͱ๨Εͯࢦఠ͞ΕΔͷͰ஫ҙ #aajug
  23. ࠷ ௿ ݶ ௥ Ճ ͠ ͨ ͍ Π ϯ

    ςϯ τ + α ʢ ໊ લ ͸ α ϯ ϓϧ ʣ • BuyIntentɿ ࣮ࡍʹߪೖ͢ΔͨΊͷΠϯςϯτ • ProductDetailIntentɿ঎඼৘ใͷৄࡉΛฉͨ͘ΊͷΠϯςϯτ • RefundIntentɿΩϟϯηϧɾฦ඼͢ΔͨΊͷΠϯςϯτ • ʢProductListIntentɿෳ਺ͷ঎඼Λఏࣔ͢ΔΠϯςϯτʣ #aajug
  24. εΩϧ ಺ ՝ ۚ εΩϧ Λ ࡞ Δ ͨ Ί

    ʹ ඞ ཁ ͳ ΋ ͷ • εΩϧ಺՝ۚ঎඼৘ใ • ঎඼৘ใͷऔಘɾߪೖɾΩϟϯηϧ༻ͷΠϯςϯτ • ঎඼໊ͷΧελϜεϩοτ • ্هϦΫΤετΛॲཧ͢ΔͨΊͷϦΫΤετϋϯυϥʔ #aajug
  25. ֦ ு ੑ Λ ߟ ͑Δ ͱ ɺ ̍ ঎

    ඼ Ͱ ΋ ε ϩ ο τ Λ • ISPͷAPI͸product idͰͷGET͔ListͷΈ • name / referenceName͋ͨΓͰfilter / find͢Δ࣮૷ʹͳΔ • product idܾΊଧͪͰGET͕ਖ਼௚ָ • ͨͩ͠idͷϋʔυίʔυʹͳΔͷͰɺ঎඼௥Ճɾมߋʹऑ͍ • synonym׆༻ͯ͠ɺISPͰొ࿥ͨ͠঎඼໊Ͱfind͢Δ࣮૷Λ #aajug
  26. s y n o n y m s ʹ Ϛ

    ο ν ͠ ͨ Β ɺ v a l u e ͷ ஋ Ͱ re s o l v e ͯ͘͠Ε Δ ε ϩ ο τ ͷ Πϝ ʔ δ
  27. εΩϧ ಺ ՝ ۚ εΩϧ Λ ࡞ Δ ͨ Ί

    ʹ ඞ ཁ ͳ ΋ ͷ • εΩϧ಺՝ۚ঎඼৘ใ • ঎඼৘ใͷऔಘɾߪೖɾΩϟϯηϧ༻ͷΠϯςϯτ • ঎඼໊ͷΧελϜεϩοτ • ্هϦΫΤετΛॲཧ͢ΔͨΊͷϦΫΤετϋϯυϥʔ #aajug
  28. g e t M o n e t i z

    a t i o n S e r v i c e C l i e n t ( ) & a d d D i re c t i v e ( )
  29. ඞ ཁ ͳ ϋ ϯ υ ϥ ʔ • BuyIntent

    • RefundIntent • ProductDetailIntent • Connections.Response + Buy • Connections.Response + Upsell • Connections.Response + Refund #aajug
  30. ඞ ཁ ͳ ϋ ϯ υ ϥ ʔ • BuyIntentɹɹɹɹɹɹɹɹɹɹɹɿߪೖ

    • RefundIntentɹɹɹɹɹɹɹɹɹ • ProductDetailIntentɹɹɹɹɹɹ • Connections.Response + Buyɹɹ • Connections.Response + Upsell • Connections.Response + Refund #aajug
  31. ඞ ཁ ͳ ϋ ϯ υ ϥ ʔ • BuyIntentɹɹɹɹɹɹɹɹɹɹɹɿߪೖ

    • RefundIntentɹɹɹɹɹɹɹɹɹɿΩϟϯηϧ • ProductDetailIntentɹɹɹɹɹɹ • Connections.Response + Buyɹɹ • Connections.Response + Upsellɹ • Connections.Response + Refund #aajug
  32. ඞ ཁ ͳ ϋ ϯ υ ϥ ʔ • BuyIntentɹɹɹɹɹɹɹɹɹɹɹɿߪೖ

    • RefundIntentɹɹɹɹɹɹɹɹɹɿΩϟϯηϧ • ProductDetailIntentɹɹɹɹɹɹɿ঎඼ৄࡉ • Connections.Response + Buyɹɹ • Connections.Response + Upsellɹ • Connections.Response + Refund #aajug
  33. ඞ ཁ ͳ ϋ ϯ υ ϥ ʔ • BuyIntentɹɹɹɹɹɹɹɹɹɹɹɿߪೖ

    • RefundIntentɹɹɹɹɹɹɹɹɹɿΩϟϯηϧ • ProductDetailIntentɹɹɹɹɹɹɿ঎඼ৄࡉ • Connections.Response + Buyɹɹɿߪೖॲཧͷ݁Ռ • Connections.Response + UpsellɹɿΞοϓηϧॲཧͷ݁Ռ • Connections.Response + Refund #aajug
  34. ඞ ཁ ͳ ϋ ϯ υ ϥ ʔ • BuyIntentɹɹɹɹɹɹɹɹɹɹɹɿߪೖ

    • RefundIntentɹɹɹɹɹɹɹɹɹɿΩϟϯηϧ • ProductDetailIntentɹɹɹɹɹɹɿ঎඼ৄࡉ • Connections.Response + Buyɹɹɿߪೖॲཧͷ݁Ռ • Connections.Response + UpsellɹɿΞοϓηϧॲཧͷ݁Ռ • Connections.Response + Refund ɿΩϟϯηϧॲཧͷ݁Ռ #aajug
  35. C o n n e c t i o n

    s . R e s p o n s e ͱ ͸ Կ ऀ ͔ ʁ • BuyIntentɹɹɹɹɹɹɹɹɹɹɹɿߪೖ • RefundIntentɹɹɹɹɹɹɹɹɹɿΩϟϯηϧ • ProductDetailIntentɹɹɹɹɹɹɿ঎඼ৄࡉ • Connections.Response + Buyɹɹɿߪೖॲཧͷ݁Ռ • Connections.Response + UpsellɹɿΞοϓηϧॲཧͷ݁Ռ • Connections.Response + Refund ɿΩϟϯηϧॲཧͷ݁Ռ #aajug
  36. εΩϧ ՝ ۚ ॲ ཧ ܥ Ͱ ͷ A l

    e x a ͷ ൃ ࿩ - B u y I n t e n t • ίΞଆͰՁ֨΍ߪೖ֬ೝͷൃ࿩͕ൃ࿩͞ΕΔ • Yes / NoͰฦ౴͢Δ • ίΞଆͰॲཧͷ݁Ռʢ੒ޭɾࣦഊʣ͕ൃ࿩͞ΕΔ • Connections.Response + BuyͷϨεϙϯε͕ൃ࿩͞ΕΔ • ݩͷૢ࡞ʹ໭Δൃ࿩ɾߪೖࣦഊ΍ΩϟϯηϧͷϑΥϩʔͳͲ #aajug
  37. ͳ ʹ ͕ Ί Μ Ͳ ͘ ͞ ͍ •

    ͍͍ͩͨϋϯυϥʔͷத਎͸ࣅͨ಺༰ʹͳΔ • ຖճϋϯυϥʔͷ࣮૷ॻ͘ͷ͕ΊΜͲ͏ • ̍εΩϧͰόάݟ͚ͭΔͱɺશεΩϧ௚͞ͳ͍ͱ͍͚ͳ͍ • ͩΕ͔Alexa޲͚ͷRoR / Symfonyతͳ΍ͭΛ #aajug
  38. ߪ ೖ ࡁ ঎ ඼ ͕ ͋ Δ ͔ ൱

    ͔ ͷ ֬ ೝ ॲ ཧ ɹ
  39. ߪ ೖ ࡁ ঎ ඼ ͕ ͋ Δ ͔ ൱

    ͔ ͷ ֬ ೝ ॲ ཧ ɹ - > ෳ ਺ ঎ ඼ ͷ ৔ ߹ ͸ ͞ Β ʹ A r r a y. f i n d ͢ Δ
  40. @ a s k - u t i l s

    / i s p • ͍͍ͩͨͲͷεΩϧͰ΋ແ೉ʹಈ͘ • ೔ӳରԠ • ঎඼ݕࡧͷϔϧύʔ΍TypeGuardͳͲ΋༻ҙ • ISPProductClient͸{products}ͰηογϣϯʹISPσʔλอଘ͢Δ • ISPHandlers͸·ͩϕʔλͳͷͰɺόά౿ΜͩΒIssue / PRΛ #aajug
  41. ՝ ۚ εΩϧ Λ ෳ ਺ ɾ ଟ ݴ ޠ

    Ͱ Ϧ Ϧ ʔε ͠ ͨ ݁ Ռ #aajug
  42. εΩϧ ՝ ۚ Ṷ ͔ Β ͳ ͍ ͷ ʁ

    • ͦ΋ͦ΋ΈΜͳ՝ۚͯ͠Δͷʁ • ʮചΕͳ͍ʯʮ·ͩจԽ͕ͳ͍ʯʮࢢ৔͕ͳ͍ʯ͸ผ໰୊ • ʮग़ͯ͠์ஔͨ͠εΩϧ͔Βऩӹ͕ग़ͨʯͱ͍͏ࣄ࣮ • ϓϨΠϠʔ͕૿͑Δલʹ΍Βͳ͍ͱւ͕੺͘ͳΔ #aajug
  43. ं ͱ Ո Λ ങ ͑Δ Ґ ɺ Ք ͍

    ͩ ਓ ͸ ͍ Δ https://edition.cnn.com/2019/05/06/tech/amazon-alexa-skills-blueprints/ index.html "Being able to buy my home and car, those are dreams come true," --- Nick Schwab
  44. A b o u t 3 0 0 , 0

    0 0 p e o p l e u s e h i s f re e a m b i e n t n o i s e s k i l l s e v e r y d a y , a n d n e a r l y 1 0 , 0 0 0 p a y f o r a s u b s c r i p t i o n v e r s i o n , w h i c h r a n g e s b e t w e e n 9 9 c e n t s a n d $ 1 . 9 9 a m o n t h https://edition.cnn.com/2019/05/06/tech/amazon-alexa-skills-blueprints/ index.html