SlideShare a Scribd company logo
LINE Messaging API 結合LinkIt 7697
檔案連結 https://goo.gl/JHVgMB
CAVEDU 薛皓云
• Ngrok
– 限制每分鐘20筆資料
架構
Ngrok網站
• Web interface:(主機對外/對內的IP,
Port)
• Forwarding(網站->主機對內IP)
Python架構
• Argparse:處理內部網域設定
• Flask:簡易的網頁溝通,Default Port:
5000
• 參考網頁:
http://flask.pocoo.org/docs/0.12/
• https://github.com/pallets/flask
• Line-bot API入門參考:
https://devdocs.line.me/en/
• API line reply robot:
https://devdocs.line.me/en/?python#repl
y-message
• Line webhook rule:
https://devdocs.line.me/en/?python#web
hook-event-object
Line Reply範例
登入LINE Business center
• https://business.line.me/zh-hant/
LINE Messaging API with LinkIt 7697
登入Line
LINE Messaging API with LinkIt 7697
LINE Messaging API with LinkIt 7697
LINE Messaging API with LinkIt 7697
透過手機進行用戶確認
註冊帳號
點選「帳號清單」
LINE Messaging API with LinkIt 7697
LINE Messaging API with LinkIt 7697
LINE Messaging API with LinkIt 7697
LINE Messaging API with LinkIt 7697
• 輸入名稱
• 上傳圖片
• 選擇業種
LINE Messaging API with LinkIt 7697
LINE Messaging API with LinkIt 7697
LINE Messaging API with LinkIt 7697
點擊開始使用API
LINE Messaging API with LinkIt 7697
LINE Messaging API with LinkIt 7697
LINE Messaging API with LinkIt 7697
LINE Messaging API with LinkIt 7697
LINE Messaging API with LinkIt 7697
LINE Messaging API with LinkIt 7697
進入LINE developers
點選 Channel Secret的SHOW
點擊OK
取得Channel Secret
點選Channel Access Token的ISSUE
設定access token的重置時間
取得Channel Access Token
Python 環境
Windows才需要另外安裝
MAC OSX、Linux(Raspberry Pi)應該都預先裝好了
https://www.python.org/
點選 Download Python 2.7.13
點擊安裝
LINE Messaging API with LinkIt 7697
LINE Messaging API with LinkIt 7697
LINE Messaging API with LinkIt 7697
LINE Messaging API with LinkIt 7697
PIP 安裝
Python的套件管理器、相當於Node.js的npm
• CODE > get-pip.py (或由此下載)
• 透過python執行
我的電腦(右鍵)內容
點選環境變數
LINE Messaging API with LinkIt 7697
輸入:; C:Python27Scripts
開啟CMD
• 在cmd下輸入以下:
– pip install line-bot-sdk
– pip install flask
Python範例
• 7697研習文件
>code>Line>app_with_handler.py
更新chn_secret&access token
• #21、22
執行(F5)
會看到以下訊息
將區網公開
https://ngrok.com/
LINE Messaging API with LinkIt 7697
LINE Messaging API with LinkIt 7697
執行ngrok
cmd輸入: ngrok http 8000
LINE Messaging API with LinkIt 7697
回到LINE DEVELOPERS
LINE Messaging API with LinkIt 7697
設定Webhook
• 將NGROK所生成的網址輸入進Webhook
URL
– 範例https://01a937aa.ngrok.io/callback
– 注意要輸入https
儲存設定
LINE Messaging API with LinkIt 7697
跟機器人加好友
測試
LinkIt 7697開發板設定
7697範例
• 7697研習文件
codeLineLine_control_led:
• Line_control_led.ino
#3 輸入ngrok所生成的網址
更新WIFI名稱&密碼#12~13
上傳程式並開啟序列埠監控視窗
透過LINE機器人控制LED
Python範例
Python rule
Flask API
EX:Line開燈,收到開燈
Handler處理器
開燈
Flask,回復一個token訊息給Line
IP試試看1
• http://127.0.0.1:8000/
IP試試看2:POST
• http://127.0.0.1:4040/
IP試試看3:GET、POST

More Related Content

PDF
微博Lamp性能优化之路(2014)
PPT
China PHP Technology Summit 2011 ppt
PDF
Weibo lamp improvements
PDF
美团点评技术沙龙06 - 滴滴移动端测试解耦工具实践
PPTX
华强北商城自动化发布系统
PDF
該怎麼樣(認真的)部署你的 Python Web 應用程式?
KEY
移动端Web开发性能优化实践
PDF
凌波微步:wagon + VS Code 的輕功哲學
微博Lamp性能优化之路(2014)
China PHP Technology Summit 2011 ppt
Weibo lamp improvements
美团点评技术沙龙06 - 滴滴移动端测试解耦工具实践
华强北商城自动化发布系统
該怎麼樣(認真的)部署你的 Python Web 應用程式?
移动端Web开发性能优化实践
凌波微步:wagon + VS Code 的輕功哲學

Similar to LINE Messaging API with LinkIt 7697 (7)

PPTX
LineBot
PDF
Build line notify bot by lotify and create client library by swagger 20200527
PDF
First line messaging bot
PDF
SignalR整合LINE,在LIFF裡建立一對一聊天管道
PDF
LINE 、 TG通訊軟體 分析
PDF
Make your line bot-using golang
PPT
Bluemix Node-Red Part I
LineBot
Build line notify bot by lotify and create client library by swagger 20200527
First line messaging bot
SignalR整合LINE,在LIFF裡建立一對一聊天管道
LINE 、 TG通訊軟體 分析
Make your line bot-using golang
Bluemix Node-Red Part I
Ad

More from CAVEDU Education (20)

PPTX
Google TPU Edge SBC_190424
PPTX
From computational Thinking to computational Action - Dr. Hal Abelson, MIT Ap...
PPTX
180321 MIT見聞分享
PPTX
BBC Micro:bit beginner project
PDF
Latte panda workshop_japan
PPTX
拿鐵熊貓外殼設計0707
PPTX
LinkIt 7697 outer case - DesignSpark Mechanical / Onkscape
PPTX
170615 國中小自造者教育師資培訓營
PPTX
170522_Raspberry Pi 相容開發板
PPTX
LinkIt 7697 IoT tutorial
PPTX
Maker Movement and Education in Taiwan
PPTX
物聯網教學與上海深圳maker行
PDF
PDF
IBM以雲端技術與物聯網創新產業應用@2016 New Taipei Maker Faire
PDF
AAEON 當創客碰上UP板 - Intel Cherry Trail 高效能maker開發者平台@2016 new taipei maker faire
PPTX
物聯網好棒棒 您專屬的IoT私有雲平台
PPTX
絕地武士心靈控制家用雲端智慧型物聯網光劍搭載無線路由器光劍底座Final
PPTX
LinkIt ONE tutorial #1- Basics
PPTX
LinkIt ONE tutorial #2- Communication and cloud service
PDF
160901 翻轉開發,活用雲端創新技術@IBM Cloud Innovation Day
Google TPU Edge SBC_190424
From computational Thinking to computational Action - Dr. Hal Abelson, MIT Ap...
180321 MIT見聞分享
BBC Micro:bit beginner project
Latte panda workshop_japan
拿鐵熊貓外殼設計0707
LinkIt 7697 outer case - DesignSpark Mechanical / Onkscape
170615 國中小自造者教育師資培訓營
170522_Raspberry Pi 相容開發板
LinkIt 7697 IoT tutorial
Maker Movement and Education in Taiwan
物聯網教學與上海深圳maker行
IBM以雲端技術與物聯網創新產業應用@2016 New Taipei Maker Faire
AAEON 當創客碰上UP板 - Intel Cherry Trail 高效能maker開發者平台@2016 new taipei maker faire
物聯網好棒棒 您專屬的IoT私有雲平台
絕地武士心靈控制家用雲端智慧型物聯網光劍搭載無線路由器光劍底座Final
LinkIt ONE tutorial #1- Basics
LinkIt ONE tutorial #2- Communication and cloud service
160901 翻轉開發,活用雲端創新技術@IBM Cloud Innovation Day
Ad

LINE Messaging API with LinkIt 7697