LINE Messaging API Workshop

Post on 21-Jan-2018

231 views 1 download

transcript

Agenda: Day2 How to LINE ChatbotLINE@ vs LINE Chatbot

Workshop

• Setup LINE Developer Account

• LINE@ CMS Overview

• Setup your own LINE Chatbot

• LINE Chatbot RichMenu

• LINE Developer Dashboard

Lauch

Workshop: Developer your LINE Chatbot

• LINE User Profile

• LINE Messaging API v2 & Limitation

• LINE Webhooks (receive)

• LINE Push vs. Reply API (send)

• LINE Bot SDK

Implement Conversational Dialog Chatbot

How to Partnership with AIYA

Conclusion

LINE Messaging APIBy MR. ATCHARIYA DAROTE

CEO & FOUDER AIYA

Messaging API Overview

https://developers.line.me/messaging-api/overview

Profile API

Profile Photo

Display Name

Status

Unique ID from LINE SystemU633424687c39c42833ca6f22f0931ca4

https://devdocs.line.me/en/#bot-api-get-profile

Push API and Reply API

https://devdocs.line.me/en/#reply-message https://devdocs.line.me/en/#push-message

1-on-1 and Group Chats

Messaging Type

Text Video / Audio ImageMap Location

Imagemap Message https://devdocs.line.me/en/#imagemap-message

Template MessageButtons Confirm Carousel

https://devdocs.line.me/en/#template-messages

Carousel Template Message

Max 5 Columns

New! Template Message

Datetime pickersupported later than

LINE 7.9.0 for iOS and LINE 7.12.0. for Android.

Image carousel

Rich Menu

Rich Menu Example

Rich Menu Example

LINE Account TypeLINE@ Free LINE@ Account (Paid) LINE Official Account

Pricing

LINE@ API BETA

http://api-register.lineapp.me/

LINE@ API BETA: Term and Conditions

[Getting API] Selected account will be contacted by our agency[Prerequisites]Eligible account needs to apply for PRO+ packageValid API license document Only Approved account is eligible for this campaign 

* This is a special campaign provided by LINE* API will be provided to LINE@ account. * API will be free of charge and valid up to 1 year.* LINE will not be responsible to the loss of account.* API cannot be resold and is solely for the use of the granted party.

LINE@ Price Plan

Q & AContact:

sale.aiya@gmail.com086-787-8030, 099-463-5924

http://www.aiya.ai

LINE Chatbot Getting Started

https://developers.line.me/messaging-api/getting-started

Go to https://business.line.me/en/

Enable BOT API

Messaging API Settings

Add Friend

LINE@ ID

Greeting Message

Rich Menu

Rich Menu

Rich Menu

Rich Menu

ซ่อน Menu

URL Tips

line://nv/locationShare Location

tel:0812345678Make call

Setup your BOT Rich Menu

Hand-on Exercise 30 mins

LINE Developer

Webhook

require HTTPS only

Example webhook event object

{ "timestamp": 1504984459576, "type": "follow", "source": { "type": "user", "userId": "U00f271c222b7351d508c1166ad2761c5" }, "replyToken": "f8e82cf0c7014437a67f86821b60c971" }

Follow event example Event object for when your account is added as a friend (or unblocked). You can reply to follow events.

Example webhook event object

{ "timestamp": 1504984484798, "message": { "text": "Hello World", "type": "text", "id": "6672977550518" }, "type": "message", "source": { "type": "user", "userId": "U00f271c222b7351d508c1166ad2761c5" }, "replyToken": "009918233f36475daa24a1ebc0610804" }

Message event Event object which contains the sent message. The message field contains a message object which corresponds with the message type. You can reply to message events.

Webhook

require HTTPS only

Channel Access Token

Test sending messages with the Messaging API

Hand-on Exercise 20 mins

Hand-on Exercise 20 mins

Hand-on Exercise 20 mins

Send mix message

https://devdocs.line.me/en/#send-message-object

Hand-on Exercise 40 mins

Echo Bot

LINE Bot SDKs

https://github.com/line/line-bot-sdk-python

System Requirements

Python: https://www.python.org/ PIP: https://pip.pypa.io VirtualEnv: https://virtualenv.pypa.io

LINE Bot SDKs

https://github.com/line/line-bot-sdk-python

git clone git@github.com:line/line-bot-sdk-python.gitcd line-bot-sdk-python virtualenv env (osx) source env/bin/activate (win) env/Scripts/activate.bat pip install -r examples/flask-echo/requirements.txt

python setup.py install

Change channel_secret & channel_access_tokenModify examples/flask-echo/app.py

python examples/flask-echo/app.py

channel_secret = ‘e2f5aba3da22c686c27ea1a…’channel_access_token = ‘kl9CWhZVT+RtOsGobPwh1zblCp4BgW…’

NGROK: Secure tunnels to localhost

Download and Installation

ngrok.com

Run in command line:

ngrok http 8000

Noted by Sahit’s A.I. Club Member: https://blog.sathit.me/ทำให้-localhost-ของเรา-online-ได้ง่ายๆ-ด้วย-ngrok-51d364564214

Setup Webhook URL

https://XXXXXX.ngrok.io/callback

NGROK: Inspecting your traffic

http://localhost:4040

Hand-on Exercise 20 mins

Kitchensink Bot

python examples/flask-echo/app.py

Hand-on Exercise 20 mins

http://chatterbot.readthedocs.io/

Q & A

Contact:atchariya@gmail.com(+66) 093-519-9696

http://www.aiya.ai