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

今から始めるLINEBot入門

 今から始めるLINEBot入門

ようかん(YosukeInoue

September 28, 2024
Tweet

More Decks by ようかん(YosukeInoue

Other Decks in Programming

Transcript

  1. ΞδΣϯμࠓ͔Β࢝ΊΔ-*/&#PU։ൃ  ͳͥ-*/&   όοΫΤϯυͷ։ൃʹूதͰ͖Δ  ΞϓϦʹඞཁͳ࠷௿ݶͷػೳ͕٧·͍ͬͯΔ ϩάΠϯ6* 

     ͙͢ʹϦϦʔεͰ͖Δ࢖ͬͯ΋Β͑Δ  -*/&ͰͰ͖Δ͜ͱ  ϝοηʔδͷ΍ΓऔΓ3FQMZ1VTI/PUJGZ  ͞·͟·ͳϝοηʔδදݱ  ۩ମతͳ࣮૷ํ๏  ·ͱΊ
  2. ΞϓϦʹඞཁͳػೳ͕٧·͍ͬͯΔ Ϣʔβʔʹ༑ୡ௥Ճ͞ΕͨλΠϛϯά͔ΒશͯVTFS*E͕ૹΒΕͯ͘ΔͷͰϩάΠϯͷ֓೦͕ͳ͍ { "replyToken": “XXXXXXXXXXXXXX”, "type": "follow", "mode": "active", "timestamp":

    1705891467176, "source": { "type": "user", "userId": "U3d3edab4f36c6292e6d8a8131f141b8b" }, "webhookEventId": "01HMQGW40RZJPJM3RAJP7BHC2Q", "deliveryContext": { "isRedelivery": false }, "follow": { "isUnblocked": false } } IUUQTEFWFMPQFSTMJOFCJ[KBSFGFSFODFNFTTBHJOHBQJGPMMPXFWFOU
  3. ΞϓϦʹඞཁͳػೳ͕٧·͍ͬͯΔ ༑ୡ௥Ճ͚ͨͩ͠Ͱ-*/&ͷνϟοτ6*Λͦͷ··࢖͑Δ ੜ੒தͷ࣌͸ϩʔσΟϯάΛग़ͤΔ { "replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA", "type": "message", "mode": "active",

    "timestamp": 1462629479859, "source": { "type": "user", "userId": "U4af4980629..." }, "webhookEventId": "01FZ74A0TDDPYRVKNK77XKC3ZR", "message": { "id": "444573844083572737", "type": "text", "quoteToken": "q3Plxr4AgKd...", "text": "ΧϨʔ", "emojis": [], "mention": { "mentionees": [] } } } IUUQTEFWFMPQFSTMJOFCJ[KBSFGFSFODFNFTTBHJOHBQJNFTTBHFFWFOU ϝοηʔδΠϕϯτ
  4. ϝοηʔδͷ΍ΓऔΓ  3FQMZ 1VTI -*/&/PUJGZ ར༻ίετ ˕ ׬શແྉ ˚ ݄௨·Ͱແྉ˞

    ˕ ͍ͭͰ΋ϝοηʔδΛૹΕΔ ʷ ϢʔβʔͷΞΫγϣϯʹ ରͯ͠ճ3FQMBZͰ͖Δ ˕ ˕ ૹ৴ઌ ެࣜΞΧ΢ϯτͱϢʔβʔͷ τʔΫϧʔϜ ެࣜΞΧ΢ϯτͱϢʔβʔͷ τʔΫϧʔϜ -*/&/PUJGZ ࣮૷ίετ ˕ ˕ ˚ ༻్ ฦ৴ ձ࿩ ͓஌Βͤ ͓஌Βͤ ˞IUUQTXXXMZDCJ[DPNKQTFSWJDFMJOFP ff i DJBMBDDPVOUQMBO
  5. ϝοηʔδͷ΍ΓऔΓ  3FQMZ 1VTI -*/&/PUJGZ ར༻ίετ ˕ ׬શແྉ ˚ ݄௨·Ͱແྉ˞

    ˕ ͍ͭͰ΋ϝοηʔδΛૹΕΔ ʷ ϢʔβʔͷΞΫγϣϯʹ ରͯ͠ճ3FQMBZͰ͖Δ ˕ ˕ ૹ৴ઌ ެࣜΞΧ΢ϯτͱϢʔβʔͷ τʔΫϧʔϜ ެࣜΞΧ΢ϯτͱϢʔβʔͷ τʔΫϧʔϜ -*/&/PUJGZ ࣮૷ίετ ˕ ˕ ˚ ༻్ ฦ৴ ձ࿩ ͓஌Βͤ ͓஌Βͤ ˞IUUQTXXXMZDCJ[DPNKQTFSWJDFMJOFP ff i DJBMBDDPVOUQMBO جຊతʹ͸ແྉͰૹΕΔ3FQMBZϕʔεͰॳظ࣮૷Λ͢Δͷ͕͓͢͢Ί
  6. ϝοηʔδͷ΍ΓऔΓ3FQMBZͰ͖ΔϢʔβʔͷΞΫγϣϯ 8FCIPPL  Ϣʔβʔ͕༑ୡొ࿥ͯ͘͠ΕͨʢϑΥϩʔΠϕϯτʣ  Ϣʔβʔ͕ϝοηʔδΛૹ͖ͬͯͨʢϝοηʔδΠϕϯτʣ  Ϣʔβʔ͕ϦονϝχϡʔͳͲͷಛఆͷ෦෼Λԡͨ͠ ϙετόοΫΠϕϯτ 

     άϧʔϓʹট଴͞Εͨ  ެࣜΞΧ΢ϯτ͔Βաڈʹૹ৴ͨ͠ɺಛఆͷಈըͷࢹௌΛϢʔβʔ͕׬ྃͨ͠  Ϣʔβʔ͕ૹ৴औΓফ͠Λߦͬͨ &UDʜ IUUQTEFWFMPQFSTMJOFCJ[KBSFGFSFODFNFTTBHJOHBQJXFCIPPLFWFOUPCKFDUT
  7. ϝοηʔδͷ΍ΓऔΓ3FQMBZͰ͖ΔϢʔβʔͷΞΫγϣϯ 8FCIPPL  Ϣʔβʔ͕༑ୡొ࿥ͯ͘͠ΕͨʢϑΥϩʔΠϕϯτʣ  Ϣʔβʔ͕ϝοηʔδΛૹ͖ͬͯͨʢϝοηʔδΠϕϯτʣ  Ϣʔβʔ͕ϦονϝχϡʔͳͲͷಛఆͷ෦෼Λԡͨ͠ ϙετόοΫΠϕϯτ 

     άϧʔϓʹট଴͞Εͨ  ެࣜΞΧ΢ϯτ͔Βաڈʹૹ৴ͨ͠ɺಛఆͷಈըͷࢹௌΛϢʔβʔ͕׬ྃͨ͠  Ϣʔβʔ͕ૹ৴औΓফ͠Λߦͬͨ &UDʜ IUUQTEFWFMPQFSTMJOFCJ[KBSFGFSFODFNFTTBHJOHBQJXFCIPPLFWFOUPCKFDUT
  8. ϝοηʔδͷ΍ΓऔΓ3FQMBZͰ͖ΔϢʔβʔͷΞΫγϣϯ 8FCIPPL  Ϣʔβʔ͕༑ୡొ࿥ͯ͘͠ΕͨʢϑΥϩʔΠϕϯτʣ  Ϣʔβʔ͕ϝοηʔδΛૹ͖ͬͯͨʢϝοηʔδΠϕϯτʣ  Ϣʔβʔ͕ϦονϝχϡʔͳͲͷಛఆͷ෦෼Λԡͨ͠ ϙετόοΫΠϕϯτ 

     άϧʔϓʹট଴͞Εͨ  ެࣜΞΧ΢ϯτ͔Βաڈʹૹ৴ͨ͠ɺಛఆͷಈըͷࢹௌΛϢʔβʔ͕׬ྃͨ͠  Ϣʔβʔ͕ૹ৴औΓফ͠Λߦͬͨ &UDʜ IUUQTEFWFMPQFSTMJOFCJ[KBSFGFSFODFNFTTBHJOHBQJXFCIPPLFWFOUPCKFDUT
  9. ϝοηʔδͷ΍ΓऔΓ3FQMBZͰ͖ΔϢʔβʔͷΞΫγϣϯ 8FCIPPL  Ϣʔβʔ͕༑ୡొ࿥ͯ͘͠ΕͨʢϑΥϩʔΠϕϯτʣ  Ϣʔβʔ͕ϝοηʔδΛૹ͖ͬͯͨʢϝοηʔδΠϕϯτʣ  Ϣʔβʔ͕ϦονϝχϡʔͳͲͷಛఆͷ෦෼Λԡͨ͠ ϙετόοΫΠϕϯτ 

     άϧʔϓʹট଴͞ΕͨʢδϣΠϯΠϕϯτʣ  ެࣜΞΧ΢ϯτ͔Βաڈʹૹ৴ͨ͠ɺಛఆͷಈըͷࢹௌΛϢʔβʔ͕׬ྃͨ͠  Ϣʔβʔ͕ૹ৴औΓফ͠Λߦͬͨ &UDʜ IUUQTEFWFMPQFSTMJOFCJ[KBSFGFSFODFNFTTBHJOHBQJXFCIPPLFWFOUPCKFDUT
  10. ϝοηʔδͷ΍ΓऔΓ3FQMBZͰ͖ΔϢʔβʔͷΞΫγϣϯ 8FCIPPL  Ϣʔβʔ͕༑ୡొ࿥ͯ͘͠ΕͨʢϑΥϩʔΠϕϯτʣ  Ϣʔβʔ͕ϝοηʔδΛૹ͖ͬͯͨʢϝοηʔδΠϕϯτʣ  Ϣʔβʔ͕ϦονϝχϡʔͳͲͷಛఆͷ෦෼Λԡͨ͠ ϙετόοΫΠϕϯτ 

     άϧʔϓʹট଴͞ΕͨʢδϣΠϯΠϕϯτʣ  ެࣜΞΧ΢ϯτ͔Βաڈʹૹ৴ͨ͠ɺಛఆͷಈըͷࢹௌΛϢʔβʔ͕׬ྃͨ͠  Ϣʔβʔ͕ૹ৴औΓফ͠Λߦͬͨ &UDʜ IUUQTEFWFMPQFSTMJOFCJ[KBSFGFSFODFNFTTBHJOHBQJXFCIPPLFWFOUPCKFDUT
  11. ϝοηʔδͷ΍ΓऔΓ3FQMBZͰ͖ΔϢʔβʔͷΞΫγϣϯ 8FCIPPL  Ϣʔβʔ͕༑ୡొ࿥ͯ͘͠ΕͨʢϑΥϩʔΠϕϯτʣ  Ϣʔβʔ͕ϝοηʔδΛૹ͖ͬͯͨʢϝοηʔδΠϕϯτʣ  Ϣʔβʔ͕ϦονϝχϡʔͳͲͷಛఆͷ෦෼Λԡͨ͠ ϙετόοΫΠϕϯτ 

     άϧʔϓʹট଴͞ΕͨʢδϣΠϯΠϕϯτʣ  ެࣜΞΧ΢ϯτ͔Βաڈʹૹ৴ͨ͠ɺಛఆͷಈըͷࢹௌΛϢʔβʔ͕׬ྃͨ͠  Ϣʔβʔ͕ૹ৴औΓফ͠Λߦͬͨ &UDʜ IUUQTEFWFMPQFSTMJOFCJ[KBSFGFSFODFNFTTBHJOHBQJXFCIPPLFWFOUPCKFDUT