46
LINE Bot (Messaging API) 최최최

Linebot

Embed Size (px)

Citation preview

Page 1: Linebot

LINE Bot(Messaging API)

최성식

Page 2: Linebot

Messaging API?

LINE 에서 제공하는 Bot 개발용 API

* 기존 BOT API Trial Account 서비스는 2016 년 11 월 16 일부로 종료

Page 3: Linebot

Messaging API 구조

Messaging API 는 LINE Server 를 통해 데이터를 ( 봇 ) 서버와 LINE 앱 사이에 릴레이하는 방식으로 작동하며 요청은 JSON 형식의 API 를 통해 전송됩니다 .

Page 4: Linebot

Messaging API 플랜

Page 5: Linebot

Messaging API SDK

+ Node.js : line-messaging(unofficial)

Page 7: Linebot

Messaging API 기능• Webhooks• Push Message API• Reply Message API• Get Contents API• Get Profile API• Leave API

Page 8: Linebot

Messaging API 기능• Webhooks

봇 서버가 사용자의 이벤트를 수신• Push Message API• Reply Message API• Get Contents API• Get Profile API• Leave API

Page 9: Linebot

Webhooks① 봇이 존재하는 채팅방에서 이벤트가 발생한다 .

② Webhooks 을 통해 Webhooks URL 로 등록된 봇 서버로 이벤트를 HTTPS POST request 방식으로 수신한다 .

③ 수신된 이벤트를 봇 서버에서 처리한다 .

④ 처리된 결과물을 이벤트가 발생된 채팅방으로 전송한다 .

Page 10: Linebot

LINE 서버로부터 봇 서버로 전달되는 이벤트 (JSON)

Page 11: Linebot
Page 12: Linebot

① “replyToken” 사용자가 봇에게 메세지를 보내고 , 봇이 그에 응답할 때 필요한 토큰

② “type” event 타입

③ “timestamp”④ “source”

a. “type” 사용자가 봇에게 메세지를 보내는 채팅방의 유형

b. “xxxxID” 채팅방의 식별자

⑤ “message” (message event)a. “id”

메세지 식별자b. ”type”

메세지 종류c. “text”

메세지 내용

Page 13: Linebot

① “replyToken” 사용자가 봇에게 메세지를 보내고 , 봇이 그에 응답할 때 필요한 토큰

② “type” event 타입

③ “timestamp”④ “source”

a. “type” 사용자가 봇에게 메세지를 보내는 채팅방의 유형

b. “xxxxID” 채팅방의 식별자

⑤ “message” (message event)a. “id”

메세지 식별자b. ”type”

메세지 종류c. “text”

메세지 내용

Page 14: Linebot

+Beacon event

Page 15: Linebot

① “replyToken” 사용자가 봇에게 메세지를 보내고 , 봇이 그에 응답할 때 필요한 토큰

② “type” event 타입 message, follow, unfollow, join, leave, post-

back

③ “timestamp”④ “source”

a. “type” 사용자가 봇에게 메세지를 보내는 채팅방의 유형

b. “xxxxID” 채팅방의 식별자

⑤ “message” (message event)a. “id”

메세지 식별자b. ”type”

메세지 종류c. “text”

메세지 내용LINE 서버로부터 봇 서버로 전달되는 이벤트 (JSON)

Page 16: Linebot

① “replyToken” 사용자가 봇에게 메세지를 보내고 , 봇이 그에 응답할 때 필요한 토큰

② “type” event 타입 message, follow, unfollow, join, leave, post-

back

③ “timestamp”④ “source”

a. “type” 사용자가 봇에게 메세지를 보내는 채팅방의 유형

b. “xxxxID” 채팅방의 식별자

⑤ “message” (message event)a. “id”

메세지 식별자b. ”type”

메세지 종류c. “text”

메세지 내용

Page 17: Linebot

Group

User

Room

Page 18: Linebot

① “user”봇과 사용자간의 1:1 대화“type” : “user”

”userId” : “xxxxxxxxx”

② ”group”그룹내에서 그룹원과 봇과의 대화“type” : “group”

“groupID” : “xxxxxxxxx“

③ “room”룸안에서 룸 구성원과 봇과의 대화“type” : “room”

“roomID” : “xxxxxxx”

userID 의 경우 user 의 식별자 그룹과 룸내의 구성원 개인 userID 는 알 수 없음

Page 19: Linebot

Messaging API 기능• Webhooks• Push Message API

봇이 사용자에게 보내는 이벤트• Reply Message API

사용자와 봇이 서로 소통하는 기능• Get Contents API• Get Profile API• Leave API

Page 20: Linebot
Page 21: Linebot

① “replyToken” 사용자가 봇에게 메세지를 보내고 , 봇이 그에 응답할 때 필요한 토큰

② “type” event 타입 message, follow, unfollow, join, leave, post-

back

③ “timestamp”④ “source”

a. “type” 사용자가 봇에게 메세지를 보내는 채팅방의 유형

b. “xxxxID” 채팅방의 식별자

⑤ “message” (message event)a. “id”

메세지 식별자b. ”type”

메세지 종류c. “text”

메세지 내용LINE 서버로부터 봇 서버로 전달되는 이벤트 (JSON)

Page 22: Linebot
Page 23: Linebot

Send message object• Text : 최대 2000 자까지• Image : 최대 1024x1024, 1MB (JPEG)• Video : 최대 1 분이하 , 10MB (mp4)• Audio : 최대 1 분이하 , 10MB (m4a)• Location : 위도와 경도 + title, address 최대 100 자까지• Sticker : sticker list - https://devdocs.line.me/files/sticker_list.pdf• Imagemap• template

URL 링크는 최대 1000 자까지

Page 24: Linebot

Send message object

Imagemap

Page 25: Linebot
Page 26: Linebot
Page 27: Linebot
Page 28: Linebot
Page 29: Linebot

Send message object

template

Page 30: Linebot
Page 31: Linebot
Page 32: Linebot
Page 33: Linebot
Page 34: Linebot
Page 35: Linebot
Page 36: Linebot
Page 37: Linebot

Messaging API 기능• Webhooks• Push Message API• Reply Message API• Get Contents API

사용자로부터 전송된 image, video, and audio 컨텐츠를 검색하는 API• Get Profile API• Leave API

Page 38: Linebot
Page 39: Linebot

Messaging API 기능• Webhooks• Push Message API• Reply Message API• Get Contents API• Get Profile API

사용자의 Profile 을 가져오는 API• Leave API

Page 40: Linebot

Get Profile API

Page 41: Linebot

Messaging API 기능• Webhooks• Push Message API• Reply Message API• Get Contents API• Get Profile API• Leave API

• 봇이 그룹이나 룸을 떠나게 하는 API

Page 42: Linebot
Page 43: Linebot

Messaging API 기능• Webhooks• Push Message API• Reply Message API• Get Contents API• Get Profile API• Leave API

+LINE Beacon

Page 44: Linebot

LINE Beacon• LINE 사용자가 LINE Beacon 에 접근하여 LINE bot 이 Web-

hooks 을 통해 알림을 받았을 때 특정 서비스를 제공하도록 하는 기능• 2016 년 9 월 이후 특정 회사나 개인사업자에게만 출시된 상태이며 , 추후에 보편화할 계획• 하나의 계정은 하나의 비콘에만 연결 될 수있음

Page 45: Linebot

Reference• Messaging API intro

https://business.line.me/ko/companies/1236120/services/bot• Messaging API documents

https://developers.line.me/messaging-api/overview• Messaging API Reference

https://devdocs.line.me/en/?java#messaging-api• Line-messaging(Node.js)

https://www.npmjs.com/package/line-messaging• Imagemap 그림 참고

http://www.slideshare.net/flashscope/line-bot-api-trial

Page 46: Linebot

Q & A