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

サーバーレスアーキテクチャで Twilioを安全に運用しよう!

サーバーレスアーキテクチャで Twilioを安全に運用しよう!

Kiminari Homma

December 08, 2015
Tweet

More Decks by Kiminari Homma

Other Decks in Technology

Transcript

  1. 5XJMJP"1*ษڧձ7PM αʔόʔϨεΞʔΩςΫνϟ Ͱ5XJMJPΛ҆શʹӡ༻͠Α͏ʂ TFMGSFF MMD ,JNJOBSJ)PNNB

  2. ࣗݾ঺հ

  3. ຊؒ ߖ੒ @kimihom ϘΫίί ӡӦऀ http://www.bokukoko.info/ CTO at selfree,llc Ruby

    on Rails, AWS, Heroku, Android, iOS TwilioJP-UG ϝϯόʔ
  4. ίʔϧίωΫτ as a Service ސ٬৘ใͱ࿈ಈͨ͠ίʔϧηϯλʔΛߏங Webϒϥ΢β͕ి࿩୅ΘΓ ֨҆ɾຊ֨ػೳɾଈ೔ಋೖ ̎िؒແྉτϥΠΞϧ࣮ࢪத αʔϏε঺հ https://www.callconnect.jp/

  5. $POUFOUT w 5XJMJPͷ෮श w ϑΥʔϧόοΫ63- w αʔόʔϨεΞʔΩςΫνϟ w ٳܜ w

    ϋϯζΦϯ
  6. ͷ෮श

  7. Voice Client ి࿩ͷड৴ Ի੠ϑΝΠϧ࠶ੜ΍௨࿩࿥Ի μΠϠϧૢ࡞ʹԠͨ͡ಈ࡞੾ସ ௨࿩தͷి࿩ͷ੍ޚ ి࿩ͷൃ৴ ϒϥ΢βɾεϚϗͰి࿩ Voice ͱ࿈ಈͯ͋͠ΒΏΔ௨࿩Λૢ࡞

    and More.. →ࣗ༝ʹ૊Έ߹ΘͤՄʂ
  8. TwiML Twilio Ͱి࿩Λड৴ɾൃ৴͢Δͱ͖ͳͲɺ Twilio ΁ಈ࡞໋ྩΛग़ͨ͢ΊͷXML Ͳ͏͢Ε͹͍͍ʁ ͜͏͠Ζ(TwiML) Webαʔόʔ <?xml version="1.0"

    encoding="UTF-8"?> <Response> <Gather action=“https://www.myapp.com/action”> <Play loop=“5”>https://www.myasset.com/voice.wav</Play> </Gather> </Response> αϯϓϧ
  9. REST API HTTP ௨৴Ͱ Twilio ͷ৘ใͷऔಘɾ࡞੒ɾߋ৽ɾ࡟আͳͲΛߦ͏ ֤ݴޠʹରԠ (PHP, Ruby, Python,

    Node.js etc) Webαʔόʔ ͜Ε΍ͬͯ ͜͏ͳΓ·ͨ͠ ྫ͑͹ ɾి࿩൪߸ͷऔಘɺߪೖɺ࡟আ ɾి࿩Λ͔͚Δɺ௨࿩ͷߋ৽ ɾSMS ૹ৴ ɾͦͷଞɺTwilio ϚΠϖʔδʹ͋Δૢ࡞ΛࣗલͰ࣮૷
  10. ϑΥʔϧόοΫ63-

  11. ϦΫΤετURL ͱ ϑΥʔϧόοΫURL ి࿩͕͔͔͖ͬͯͨͱ͖ʹɺ࠷ॳʹ Twilo ͕ฉ͖ʹߦ͘ URL Ͳ͏͢Ε͹͍͍ʁ Error! Webαʔόʔ

    ϦΫΤετURL ϦΫΤετ URL ͰTwiMLΛղੳͰ͖ͳ͔ͬͨ৔߹ʹฉ͖ʹߦ͘URL ϑΥʔϧόοΫ URL ϦΫΤετ URL Ͳ͏͢Ε͹͍͍ʁ ϑΥʔϧόοΫ URL ͜͏͠Ζ(TwiML)
  12. ʮΞϓϦέʔγϣϯͷΤϥʔ͕ൃੜ͠·ͨ͠ɻʯ 4BZ

  13. 1SPCMFN w ి࿩Λ͔͚ͨਓ͔͠໰୊͕͙͢ʹΘ͔Βͳ͍ w ΞϥʔττϦΨʔ͸࠷΋୹ͯ͘೔ w 5XJMJPμογϡϘʔυͷϩάΛຖճݟΔͷ͸େม w ΞϓϦέʔγϣϯͷ͍ͤʹͳͬͯ͠·͏ ͦͷ௨Γ͕ͩ

  14. ϦΫΤετURL ͱ ϑΥʔϧόοΫURL ి࿩͕͔͔͖ͬͯͨͱ͖ʹɺ࠷ॳʹ Twilo ͕ฉ͖ʹߦ͘ URL Ͳ͏͢Ε͹͍͍ʁ Error! Webαʔόʔ

    ϦΫΤετURL ϦΫΤετ URL ͰTwiMLΛղੳͰ͖ͳ͔ͬͨ৔߹ʹฉ͖ʹߦ͘URL ϑΥʔϧόοΫ URL ϦΫΤετ URL Ͳ͏͢Ε͹͍͍ʁ ϑΥʔϧόοΫ URL ͜͏͠Ζ(TwiML) ?
  15. ϑΥʔϧόοΫ63-ઌͷ৚݅ w ϦΫΤετ63-ͱ͸ҧ͏αʔόʔͰ͋Δ w ·ͣམͪΔ͜ͱ͕ͳ͍ w ΤϥʔΛݕ஌Ͱ͖ΔΑ͏ʹ͢ΔͨΊɺ੩తͳϑΝΠ ϧͰͳ͘ɺϓϩάϥϜΛಈ͔͍ͨ͠

  16. ͦ͜Ͱ lαʔόʔϨεΞʔΩςΫνϟz 1)1ͳͲͷαʔόʔΛ͜ͷͨΊʹΘ͟Θ ͟ݐͯΔͷ͸࡞Δͷ΋؅ཧ͢Δͷ΋໘౗ɻ ͓ͦͯۚ͠΋͔͔Δɻ

  17. "84-BNCEB "NB[PO"1*(BUFXBZ lαʔόʔϨεΞʔΩςΫνϟz

  18. ɾ"84಺ͷΠϕϯτΛτϦΨʹɺ೚ҙͷ ίʔυΛ࣮ߦ ɾ/PEFKT+BWB1ZUIPO ɾ-JOVY؀ڥʹ"844%, *NBHF.BHJDL ͕಺ଂ ɾ[email protected]ͳͲΛ;JQʹݻΊͯΞοϓ ϩʔυՄ ɾ͔݄ʹສ݅ͷϦΫΤετ͓Αͼ 

    (#ඵͷίϯϐϡʔςΟϯά࣌ؒ ͕ແྉ ɾϩά͸$MPVE8BUDIͰӾཡ "84-BNCEB
  19. w "NB[PO4ʹը૾͕Ξοϓϩʔυ͞ΕͨλΠϛϯά Ͱɺը૾ΛϦαΠζ w "NB[PO%ZOBNP%#ʹσʔλ͕౤ೖ͞ΕͨλΠϛϯά ͰɺσʔλΛ੔ܗ w $SPOͷΑ͏ʹ೔ҰճͷλΠϛϯάͰɺόονॲཧΛ ࣮ߦ w

    όοΫάϥ΢ϯυδϣϒΛ"84-BNCEBԽ &YBNQMFTPG"84-BNCEB
  20. "NB[PO"1*(BUFXBZ ɾ֎෦"1*Λެ։͢Δͷʹ໾ཱͭ ɾ"84-BNCEBΛΤϯυϙΠϯτͱ ͯ͠ࢦఆՄೳ ɾಠࣗ63-ͷൃߦ ɾ"1*ͷόʔδϣϯ؅ཧɾ࣮ߦ੍ݶ ɾJ04"OESPJE޲͚4%,ൃߦ ɾ4XBHHFSରԠ ࠓ೥ͷ݄ϦϦʔεʂ ݄ʹ౦ژϦʔδϣϯ։ઃ

  21. ͣͬͱಈ͍͍ͯΔzαʔόʔzͷ֓೦͕ͳ͘ͳΓɺ ඞཁʹͳͬͨͱ͖ʹىಈͯ͠αʔόʔͷΑ͏ʹৼΔ෣͏ ௿ίετɺߴՄ༻ੑΛ࣮ݱ

  22. :PVS 4FSWFS Ϧ Ϋ Τ ε τ 6 3- Τ

    ϥ ʔ ʂ ి࿩ ᶃ ᶄ ᶅ "1* (BUFXBZ -BNCEB ϑ Υ ʔ ϧ ό ο Ϋ 6 3 - 5X J. -
  23. 5XJMJPϦΫΤετ63-Λ αʔόʔϨεΞʔΩςΫνϟԽʁ ͦΕ΋ (PPE4PMVUJPO

  24. ࠓճͷϋϯζΦϯ w "84-BNCEBͷίʔυ࡞੒ w "NB[PO"1*(BUFXBZͷઃఆͱσϓϩΠ w ϑΥʔϧόοΫ63-Λ"NB[PO"1*(BUFXBZ΁ w 5XJMJPͷϦΫΤετ63-Λଘࡏ͠ͳ͍63-΁ w

    ಈ࡞֬ೝ
  25. ϋϯζΦϯखॱ͸݄೔ͷ 5XJMJP"EWFOU$BMFOEBSʹͯ