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

Twilioハンズオン!電話の自動音声応答を作ってみよう

0b4cbf51d6521b3a7fd030b28107fb1f?s=47 friendtree16
September 02, 2021

 Twilioハンズオン!電話の自動音声応答を作ってみよう

以下イベントのハンズオンで利用した資料です。
https://kaishi-fc.connpass.com/event/220524/

0b4cbf51d6521b3a7fd030b28107fb1f?s=128

friendtree16

September 02, 2021
Tweet

Transcript

  1. 5XJMJPϋϯζΦϯʂ ి࿩ͷࣗಈԠ౴Λ࡞ͬͯΈΑ͏

  2. ࣗݾ঺հ ໊લɿᷤɹஐلʢ͔ͭɹͱ΋͖ʣ ॴଐɿKDDI΢Σϒίϛϡχέʔγϣϯζ ɹɹɹTwilioຊ෦ɹϚʔέςΟϯάνʔϜ ܦྺɿ 2014೥ΑΓiOSɺAndroidͷωΠςΟϒΞϓϦέʔγϣϯ։ൃɺAngular΍LaravelΛ༻͍ͨ΢ΣϒΞϓϦέʔ γϣϯ։ൃʹैࣄɻ2020೥5݄ΑΓTwilioࣄۀ෦ʹδϣΠϯ͠ɺTwilioͷ࠷৽৘ใͷൃ৴΍TwilioΛ༻͍ͨ஍ Ҭ՝୊ղܾΛ୲౰ɻ 2021೥ʙɿTwilio Champion

    ஶॻɿʢ2021/3ʣʰ͸͡ΊͯͷTwilioʱ޻ֶࣾ
  3. ΞδΣϯμ 1. Twilioʹ͍ͭͯ 2. TwilioΞΧ΢ϯτͷ࡞੒ 3. ి࿩൪߸ͷߪೖ 4. ి࿩ͷࣗಈԻ੠Ԡ౴ͷ࡞੒ʢൃ৴ɾண৴ʣ 5.

    SMSૹ৴ 6. Twilio Questͷ঺հ
  4. Twilio ʹ͍ͭͯ

  5. Twilioͱ͸

  6. Twilio͕ఏڙ͍ͯ͠ΔϓϩμΫτҰཡ

  7. Twilioͷར༻ྫ

  8. Twilioͷར༻ྫ

  9. Twilioͷར༻ྫ

  10. Twilioͷར༻ྫ

  11. KDDI΢ΣϒίϛϡχέʔγϣϯζͱTwilio

  12. TwilioΞΧ΢ϯτͷ࡞੒

  13. TwilioΞΧ΢ϯτͷ࡞੒

  14. TwilioΞΧ΢ϯτͷ࡞੒

  15. ి࿩൪߸ͷߪೖ

  16. ి࿩൪߸ʹ͍ͭͯ • TwilioͰఏڙ͍ͯ͠Δి࿩൪߸ͷࠃ਺ • 100ΧࠃҎ্ • ೔ຊͷ൪߸Ͱఏڙ͍ͯ͠Δి࿩൪߸ͷछྨ • 050൪߸ʢి࿩ͷडൃ৴ͷΈɾSMSૹ৴ෆՄʣ •

    0120/0800൪߸ʢண՝ۚํࣜʣ • ೔ຊ൪߸ߪೖʹ͋ͨͬͯཹҙࣄ߲ • ຊਓ֬ೝ͕ඞཁ • https://cloudapi.kddi-web.com/magazine/twilio-lesson/how-to-buy-a-telephone-number • 0120൪߸Λߪೖ͢Δʹ͸ɺฐࣾ·Ͱ͓໰͍߹Θ͍ͤͩ͘͞ɻ
  17. ి࿩൪߸ͷߪೖ

  18. ి࿩ͷࣗಈԻ੠Ԡ౴ͷ࡞੒ʢൃ৴ʣ

  19. TwilioͰࣗಈԻ੠Ԡ౴Λ࡞Δ࣌ͷߏ੒ IBM Cloud

  20. IBM CloudίϚϯυͷ४උ curl -fsSL https://clis.cloud.ibm.com/install/osx | sh iex(New-Object Net.WebClient).DownloadString('https://clis.cloud.ibm.com/ install/powershell')

    ࢀরϖʔδ https://cloud.ibm.com/docs/cli?topic=cli-install-ibmcloud-cli&locale=ja Mac Windows PowerShell Login Ibmcloud login
  21. IBM Cloud FunctionsΛ༗ޮԽ͢Δ 1.IBM CloudͷΞΧ΢ϯτʹϩάΠϯ 2.Cloud FunctionsμογϡϘʔυΛදࣔ 3.໊લۭؒΛબ୒

  22. ιʔείʔυͷ४උ https://github.com/friendtree16/TwiMLServer-IBMCloud-Functions

  23. ιʔείʔυͷ४උ Index.js

  24. ιʔείʔυͷ४උ ύοέʔδΠϯετʔϧ WebpackόϯυϧΛϏϧυ IBM Cloud FunctionsʹσϓϩΠ npm install npm run

    build npm run deploy
  25. IBM Cloud FunctionsΛ४උ

  26. IBM Cloud FunctionsΛ४උ

  27. IBM Cloud FunctionsΛ४උ

  28. IBM Cloud FunctionsΛ४උ ύεɿ’/twiml’ͱೖྗ͠·͢ verbɿPOSTΛબ୒͠·͢ ΞΫγϣϯΛؚΉύοέʔδɿσϑΥϧτΛબ୒͠·͢ ΞΫγϣϯɿhello-twilioΛબ୒Λબ୒͠·͢ Ԡ౴ίϯςϯπɾλΠϓɿΞΫγϣϯ͔Β”Context-Type” ϔομʔΛ࢖༻͠·͢Λબ୒͠·͢

  29. IBM Cloud FunctionsΛ४උ

  30. IBM Cloud FunctionsΛ४උ URL͸ܦ࿏ͷޙΖʹ/twimlΛ͚ͭͨ΋ͷʹͳΓ·͢ɻ ྫɿhttps://xxxxxxxx.us-south.apigw.appdomain.cloud/api/twiml

  31. ి࿩Λൃ৴ʢAPIʣ curl -X POST https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/Calls.json \ --data-urlencode "Url=https://xxxxxxxx.us-south.apigw.appdomain.cloud/api/twiml" \ --data-urlencode

    "To=+819012345678" \ (ൃ৴͢Δઌͷి࿩൪߸) --data-urlencode "From=+15017122661" \ (ൃ৴͢Δݩͷి࿩൪߸) -u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
  32. ి࿩Λൃ৴ʢAPI Explorerʣ ൃ৴ઌి࿩൪߸ ൃ৴ݩి࿩൪߸ TwiMLͷURL

  33. ి࿩ͷࣗಈԻ੠Ԡ౴ͷ࡞੒ʢண৴ʣ

  34. ి࿩൪߸ʹURLΛઃఆ ͜͜ʹURLΛઃఆ͢Δ

  35. TwiML Appͷ࡞੒

  36. TwiML Appͷ࡞੒ ೚ҙͷ໊લ URL

  37. ண৴ςετ

  38. ϏδϡΞϧϓϩάϥϛϯάͰϑϩʔΛ࡞੒

  39. Twilio Studio • ίϛϡχέʔγϣϯϫʔΫϑϩʔͷ࡞੒͔Β؅ཧΛɺશͯϒϥ΢β্Ͱߦ͏͜ͱ͕Ͱ͖·͢ ༻్ʹԠͨ͡ίϛϡχέʔγϣϯϫʔΫϑϩʔΛ࡞੒͠ɺͦΕΒΛҰݩ؅ཧ͢Δ͜ͱ͕Ͱ͖·͢ɻϒϥ΢β ্Ͱ࡞੒͢ΔίϛϡχέʔγϣϯϫʔΫϑϩʔͷ਺΍࣮ߦճ਺ʹର͢Δ੍ݶ͸͋Γ·ͤΜɻ • ద੾ͳίϛϡχέʔγϣϯνϟωϧͰͷ௨৴ Twilio͸ɺ༷ʑͳίϛϡχέʔγϣϯνϟωϧΛ༻ҙ͓ͯ͠Γ·͢ɻ ి࿩ɺSMSɺFacebook

    Messenger΍LINE ͳͲɺ͓޷͖ͳίϛϡχέʔγϣϯνϟωϧͱ࿈ܞ͠ɺίϛϡχέʔγϣϯϫʔΫϑϩʔΛߏங͢Δ͜ͱ͕ ՄೳͰ͢ɻ • γʔϜϨεͳσʔλ࿈ܞ ࣗࣾͰطʹ࢖༻͍ͯ͠ΔαʔυύʔςΟ੡γεςϜ΍γεςϜج൫ͱ࿈ܞͰ͖·͢ɻ͜ΕʹΑΓɺγʔϜϨ εͳσʔλͷ࿈ܞ͕ՄೳʹͳΓ·͢ɻ
  40. Twilio StudioͰϑϩʔΛ࡞੒

  41. Twilio StudioͰϑϩʔΛ࡞੒ ࿩͢͜ͱ͹ ݴޠͷछྨ Ի੠ͷछྨ

  42. ి࿩൪߸ʹϑϩʔΛઃఆ Studio FlowΛબ୒ ࡞ͬͨFlowΛઃఆ

  43. TwiML AppʹURLΛઃఆ ίϐʔ ϖʔετ

  44. ண৴ςετ

  45. SMSͷૹ৴

  46. Programmable SMSͷಛ௃ • SMSΛૹ৴͢Δࡍ͸ΞϝϦΧͷ൪߸Λར༻ • ΦϓγϣϯͰࠃ಺௚ऩϧʔτ΋ఏڙ • ૹ৴ݩͱͯ͠ɺΞϧϑΝϕοτΛઃఆ͢Δ͜ͱ΋Մೳ • SMSΛड৴͢Δ͜ͱ΋Ͱ͖Δ͕ɺૹ৴ऀଆ͕ࠃࡍSMSʹͳͬͯ͠·͏ͨΊɺ஫ҙ

  47. SMSૹ৴ curl -X POST https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/Messages.json \ --data-urlencode “Body=͜͜ͰຊจΛࢦఆ͠·͢ɻ" \ --data-urlencode

    "From=+15017122661" \ (ૹ৴ݩి࿩൪߸) --data-urlencode “To=+819012345678" \ʢૹ৴ઌి࿩൪߸ʣ -u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
  48. Twilio Questͷ঺հ

  49. Twilio Questͷ঺հ https://www.twilio.com/quest/ja

  50.  ͝ࢹௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ɻ