b 3 line bot live coding
Post on 16-Apr-2017
6.656 Views
Preview:
TRANSCRIPT
BOT API Trial Problems
Complexity of features with rich UI/UX
Need to send message one-by-one in order to receive response from users
Cannot join group
Etc…
API is complex
LINE BOT & Messaging API
New Message API
Added new MessageType
Events that can be accepted
via webhook
Participation in groups
New features added to LINE Bot
New Messaging API
LINE Chat (1-on-1 or group)
1. Reply API
LINE Server Bot Application
LINE
Message
Your System
Webhook
Reply ID
New Messaging API
LINE Chat (1-on-1 or group)
1. Reply API
LINE Server Bot Application
LINE
Message
Your System
Webhook
Reply ID
Message Reply
With reply ID
New Messaging API
LINE Server
2. Push API
LINE Chat (1-on-1 or group) Bot Application
LINE
Message
Your System
Push
with user ID / group ID
BOT API Trial Message API cur l -X POST ¥ -H 'Content-Type: appl icat ion/ json' ¥ -H 'X-Line-Channel ID: <Channel ID>' ¥ -H 'X-Line-ChannelSecret : <Channel Secret> ' ¥ -H 'X-Line-Trusted-User-With-ACL: <Channel MID>' ¥ -d '{ " to" : ["userId1"] , " toChannel" :1383378250, "eventType":"138311608800106203", "content" :{ "contentType":1, " toType":1, " text" :"Hel lo, Jose!" } } ’ h t tps:/ / t r ia lbot-api . l ine.me/v1/events
BOT API Trial Message API cur l -X POST ¥ -H 'Content-Type: appl icat ion/ json' ¥ -H 'X-Line-Channel ID: <Channel ID>' ¥ -H 'X-Line-ChannelSecret : <Channel Secret> ' ¥ -H 'X-Line-Trusted-User-With-ACL: <Channel MID>' ¥ -d '{ " to" : ["userId1"] , " toChannel" :1383378250, "eventType":"138311608800106203", "content" :{ "contentType":1, " toType":1, " text" :"Hel lo, Jose!" } } ’ h t tps:/ / t r ia lbot-api . l ine.me/v1/events
Too many Bot Info
Fixed Magic Number
Unknown value Fixed Magic Number
New Messaging API
curl -X POST ¥ -H "Content-Type:application/json" ¥ -H "Authorization: Bearer <Access Token>" ¥ -d '{ "to": "userId or groupId", "messages": [ {"type": "text", "text": "Hello LINE Bot" } ] } ' https://api.line.me/v2/bot/message/push
{ " t y p e " : " t e m p l a t e " , " a l t Te x t " : " t h i s i s a n t e m p l a t e " , " t e m p l a t e " : { " t y p e " : b u t t o n s " , " t h u m b n a i l I m a g e U r l " : " h t t p : / / e x a m p l e . c o m / i m a g e . j p g " , " t i t l e " : " C u r r e n t We a t h e r … " , " t e x t " : " 9 / 2 9 We a t h e r … " , " a c t i o n s " : [ { " t y p e " : " m e s s a g e " , " l a b e l " : ” H o w a b o u t … " , " t e x t " : " H o w a b o u t … " } , { " t y p e " : " u r i " , " l a b e l " : ” O p e n B r o w s e r " , " u r i " : " h t t p s : / / l i n e . m e " } ] } }
{ " t y p e " : " t e m p l a t e " , " a l t Te x t " : " t h i s i s a n t e m p l a t e " , " t e m p l a t e " : { " t y p e " : b u t t o n s " , " t h u m b n a i l I m a g e U r l " : " h t t p : / / e x a m p l e . c o m / i m a g e . j p g " , " t i t l e " : " C u r r e n t We a t h e r … " , ” t e x t " : " 9 / 2 9 We a t h e r … " , " a c t i o n s " : [ { " t y p e " : " m e s s a g e " , " l a b e l " : ” H o w a b o u t … " , " t e x t " : " H o w a b o u t … " } , { " t y p e " : " u r i " , " l a b e l " : ” O p e n B r o w s e r " , " u r i " : " h t t p s : / / l i n e . m e " } ] } }
{ " t y p e " : " t e m p l a t e " , " a l t Te x t " : " t h i s i s a n t e m p l a t e " , " t e m p l a t e " : { " t y p e " : b u t t o n s " , " t h u m b n a i l I m a g e U r l " : " h t t p : / / e x a m p l e . c o m / i m a g e . j p g " , " t i t l e " : " C u r r e n t We a t h e r … " , " t e x t " : " 9 / 2 9 We a t h e r … " , " a c t i o n s " : [ { " t y p e " : " m e s s a g e " , " l a b e l " : ” H o w a b o u t … " , " t e x t " : " H o w a b o u t … " } , { " t y p e " : " u r i " , " l a b e l " : ” O p e n B r o w s e r " , " u r i " : " h t t p s : / / l i n e . m e " } ] } }
{ " t y p e " : " t e m p l a t e " , " a l t Te x t " : " t h i s i s a n t e m p l a t e " , " t e m p l a t e " : { " t y p e " : b u t t o n s " , " t h u m b n a i l I m a g e U r l " : " h t t p : / / e x a m p l e . c o m / i m a g e . j p g " , " t i t l e " : " C u r r e n t We a t h e r … " , ” t e x t " : " 9 / 2 9 We a t h e r … " , " a c t i o n s " : [ { " t y p e " : " m e s s a g e " , " l a b e l " : ” H o w a b o u t … " , " t e x t " : " H o w a b o u t … " } , { " t y p e " : " u r i " , " l a b e l " : ” O p e n B r o w s e r " , " u r i " : " h t t p s : / / l i n e . m e " } ] } }
{ " type" : " template" , "a l tText" : " th is is an template" , " template" : { " type" : “conf i rm”, " text" : "Are you sure?" , "act ions" : [{ " type" : "message", " label" : "OK", " text" : "Yes, Please" } , { " type" : "message", " label" : ”Cancel" , " text" : "No thank you" }] } }
{ " type" : " template" , "a l tText" : " th is is an template" , " template" : { " type" : "carousel" , "columns": [{ " thumbnai l ImageUrl” :"ht tp :/ /…", " t i t le" : "Current Whether…", ” text" : "9/29 Whether…", "act ions" : [ . . . ] } , { " thumbnai l ImageUrl” : "ht tp :/ /…", " t i t le" : "Current Whether…", " text" : "9/30 Whether…", "act ions" : [ . . . ] } ]} }
{ " type" : " template" , "a l tText" : " th is is an template" , " template" : { " type" : "carousel" , "columns": [{ " thumbnai l ImageUrl” :"ht tp :/ /…", " t i t le" : "Current Whether…", ” text" : "9/29 Whether…", "act ions" : [ . . . ] } , { " thumbnai l ImageUrl” : "ht tp :/ /…", " t i t le" : "Current Whether…", " text" : "9/30 Whether…", "act ions" : [ . . . ] } ]} }
{ " type" : " template" , "a l tText" : " th is is an template" , " template" : { " type" : "carousel" , "columns": [{ " thumbnai l ImageUrl” :"ht tp :/ /…", " t i t le" : "Current Whether…", ” text" : "9/29 Whether…", "act ions" : [ . . . ] } , { " thumbnai l ImageUrl” : "ht tp :/ /…", " t i t le" : "Current Whether…", " text" : "9/30 Whether…", "act ions" : [ . . . ] } ]} }
{ " type" : " template" , "a l tText" : " th is is an template" , " template" : { " type" : "carousel" , "columns": [{ " thumbnai l ImageUrl” :"ht tp :/ /…", " t i t le" : "Current Whether…", ” text" : "9/29 Whether…", "act ions" : [ . . . ] } , { " thumbnai l ImageUrl” : "ht tp :/ /…", " t i t le" : "Current Whether…", " text" : "9/30 Whether…", "act ions" : [ . . . ] } ]} }
Webhook
LINE Chat (1-on-1 or group)
LINE Server Bot Application
LINE
Message
Your System
Webhook
LINE Chat (1-on-1 or group)
Event
{ "events": […] }
event
contact status
“follow” “unfollow”
group status
“join” “leave”
“beacon” “postback”
“message”
• Text • Image • Location • Sticker • Contact
Postback? Send Event to Your Server Directly with Parameters.
{ " rep lyToken" : “xxxxxxxxxx" , " type" : "postback" , " t imestamp": 1462629479859, "source" : { " type" : "user" , "user Id" : "xxxxxxxxxxxx" } , "postback" : { "da ta" : "ac t ion=remind&i temId=123" , } }
Bot Appl icat ion Webhook
Summary
New Message API
Added new Message Type
Events that can be accepted
via webhook
Participation in groups
New features added to Messaging API
top related