Linebot Django 8

less than 1 minute read

LINE BOT Message 初學者記錄(八)  Casual template: Yelp restaurant + Location 為了能在各國旅遊時可以方便找到優質餐廳, 結合 Location 和 Yelp 即可輕鬆達成

先看作品完成圖: 不管德國, 台灣, 美國… 都可輕鬆取得優質餐廳資訊

        

Step1 - Distinguish message from user is Location or Text:

從上圖看出使用者輸入 location 會有一個 type: location, 因此我們只需要在 main function 裡判斷來源字串的 message_type 即可 if message_type == 'location':

Step2 - Yelp function:

我們 github 可看到現成的 yelp api in Python language. 並將吃進去的 address 最後 filter 出我們要的 ‘name’, ‘address’, ‘photo’, ‘url’

Step3 - Apply Yelp result to LINE:

使用 LINE BOT Message 初學者記錄(三)    News 相同 casual template 方法 可以先檢查一下 payload data 符合我們預期的

就完成喽!! 現在只要丟出 Location 就可得到附近優質餐廳推薦!!

 

南瓜出沒 掃描 QR Code 專區

剛好看到有興趣試試可以加入玩一下

What’s next:

  1. 結合 GPS 定位找飲料店
  2. 學別人上傳照片到 Google Cloud
  3. 結合 Spread Sheet 來記帳看起來不錯, 但我不記帳的 >< 
  4. 英文選擇題練習給認真的學生, 可惜沒看到 Free API
  5. 結合 ML 套件玩分析

2017/9/30

下一篇:  Line Bot - Dialogflow

Leave a comment