![使用 App Inventor 傳送訊息到 LINE 使用 App Inventor 傳送訊息到 LINE](https://i0.wp.com/i.imgur.com/pW4kgPc.png?resize=1140%2C641&ssl=1)
使用 App Inventor 傳送訊息到 LINE
之前有介紹過,使用 IFTTT 這個服務平台,直接從 App Inventor 傳送 Gmail 信件,今天則要來介紹,如何把訊息從 App Inventor 傳送到 LINE Notify 顯示。
1. 進入 IFTTT 官網後,登入帳號,並點選右上方的 Create 按鈕。
![](https://i0.wp.com/i.imgur.com/6CY4x0V.png?w=960&ssl=1)
點黑色 If This 按鈕
![](https://i0.wp.com/i.imgur.com/uiZsz7b.png?w=960&ssl=1)
於 Search services 搜尋框輸入 Webhooks,然後點下去。
![](https://i0.wp.com/i.imgur.com/FrFpjrF.png?w=960&ssl=1)
再點左邊的 Receive a web request
![](https://i0.wp.com/i.imgur.com/l8QpBj9.png?w=960&ssl=1)
輸入完 Event Name 後再點 Create trigger (Event Name 等等要設為網路元件網址的一部份,可以先複製起來。)
![](https://i0.wp.com/i.imgur.com/j44fOwM.png?w=960&ssl=1)
接著要換 Then That,點下去。
![](https://i0.wp.com/i.imgur.com/FUFSJml.png?w=960&ssl=1)
於 Search services 搜尋框輸入 LINE,然後點下去。
![](https://i0.wp.com/i.imgur.com/nc7ylVB.png?w=960&ssl=1)
點 Send message
![](https://i0.wp.com/i.imgur.com/NjfrNdN.png?w=960&ssl=1)
參數先參照我的,然後按 Create action。
![](https://i0.wp.com/i.imgur.com/xm78IgE.png?w=960&ssl=1)
都好了之後再點 Continue
![](https://i0.wp.com/i.imgur.com/N2FxxCu.png?w=960&ssl=1)
最後點 Finish 就完成了!
接著要來複製 Webhooks 的金鑰,點右上角的人頭按鈕,再點 My services。
![](https://i0.wp.com/i.imgur.com/cMwOMGE.png?w=960&ssl=1)
底下會列出,妳已經有在使用的服務。
請選 Webhooks
![](https://i0.wp.com/i.imgur.com/utkli8C.png?w=960&ssl=1)
點 Documentation
![](https://i0.wp.com/i.imgur.com/weMaLWA.png?w=960&ssl=1)
請參照底下圖片的方法
![](https://i0.wp.com/i.imgur.com/i3gEa7c.png?w=960&ssl=1)
2. 開啟 App Inventor 並新增一個專案
需要元件如下:
![](https://i0.wp.com/i.imgur.com/orxVoSy.png?w=960&ssl=1)
切換到程式設計
新增兩個變數,分別是金鑰和 Event Name。
![](https://i0.wp.com/i.imgur.com/HcMOKRE.png?w=960&ssl=1)
實作傳送按鈕的程式如下:
![](https://i0.wp.com/i.imgur.com/gcDKPsD.png?w=960&ssl=1)
網址格式是剛剛在 Documentation 複製的
呼叫網路執行 POST 文字請求那裡,因為剛剛建置時,只有用 Value1 一個參數。
如果要使用上次傳送 Gmail 時的格式,則需要在設定網址底下增加以下方塊:
![](https://i0.wp.com/i.imgur.com/zZ1YRAo.png?w=960&ssl=1)
然後 POST 文字請求的方塊也要改成如下:
![](https://i0.wp.com/i.imgur.com/dB8RZuV.png?w=960&ssl=1)
最後,當網路元件取得文字後,關閉進度框,整個程式就完成了!
![](https://i0.wp.com/i.imgur.com/7Sv6Mb3.png?w=960&ssl=1)
App 完整程式方塊
![](https://i0.wp.com/i.imgur.com/9zXb2em.png?w=960&ssl=1)
App Inventor 專案程式檔下載
App 專案執行範例
如果覺得文章內容還不錯的話,麻煩請幫我點個讚!感謝
可以多點幾次喔~~
第一次點讚需使用 Google 或 Facebook 帳號註冊
![使用 App Inventor 讀取統一發票中獎號碼 使用 App Inventor 讀取統一發票中獎號碼](https://i0.wp.com/i.imgur.com/bkBZAT5.png?resize=75%2C75&ssl=1)