2023年9月24日 星期日

Node-Red Line API流程

 Node-Red Line API流程


 

功能 : 透過 Node-Red 送出 訊息 給Line Notify

 

節點

設定功能

備註

Inject

文字: Hello , Alex9ufo

 

Function

msg.headers = {'content-type':'application/x-www-form-urlencoded','Authorization':'Bearer A4wwPNh2WqB7dlfeQyyIAwtggn1kfZSI5LkkCdia1gB'};

msg.payload = {"message":msg.payload};

return msg;

 

黃色的Line Notify 發行存取權杖

A4wwPNh2WqB7dlfeQyyIAwtggn1kfZSI5LkkCdia1gB

改成自己的 Line Nofity發行存取權杖

 

http request

POST

https://notify-api.line.me/api/notify



 

debug

none

 

 

Line Notify 發行權杖的取得

1

進入 line notify


 

2

登入



 

3

登入

 



 

4

進入 個人頁面


 

5

進入 發行存取權杖

 

6

1)權杖名稱

2) Line Notify

3) 發行





 

7

複製 發行權杖

eLH924qdb5RjPF9NpHG2RInFj6pzt9jUM8URBbAjXKxO

 

8

 

到node-red  function 修改發行權杖

 

msg.headers = {'content-type':'application/x-www-form-urlencoded','Authorization':'Bearer A4wwPNh2WqB7dlfeQyyIAwtggn1kfZSI5LkkCdia1gB'};

msg.payload = {"message":msg.payload};

return msg;

黃色的Line Notify 發行權杖

改成自己的 Line Nofity發行權杖

 

 

 

測試 結果

inject






查看看你的Line Notify 是否有接收訊息















[{"id":"e12d29fdde961bef","type":"function","z":"67afc0aa952275dd","name":"Set Line API ","func":"msg.headers = {'content-type':'application/x-www-form-urlencoded','Authorization':'Bearer eLH924db5RjPF9NpHG2RInFj6pzt9jUM8URBbAjXKxO'};\nmsg.payload = {\"message\":msg.payload};\nreturn msg;\n\n//oR7KdXvK1eobRr2sRRgsl4PMq23DjDlhfUs96SyUBZu","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":270,"y":120,"wires":[["6c6abe5a5c48853b"]]},{"id":"6c6abe5a5c48853b","type":"http request","z":"67afc0aa952275dd","name":"","method":"POST","ret":"txt","paytoqs":false,"url":"https://notify-api.line.me/api/notify","tls":"","persist":false,"proxy":"","authType":"","x":440,"y":120,"wires":[["42055b911f189408"]]},{"id":"41d288294c769f85","type":"inject","z":"67afc0aa952275dd","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Hello , Alex9ufo ","payloadType":"str","x":160,"y":60,"wires":[["e12d29fdde961bef"]]},{"id":"42055b911f189408","type":"debug","z":"67afc0aa952275dd","name":"debug ","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":570,"y":120,"wires":[]}]

沒有留言:

張貼留言

2024_09 作業3 以Node-Red 為主

 2024_09 作業3  (以Node-Red 為主  Arduino 可能需要配合修改 ) Arduino 可能需要修改的部分 1)mqtt broker  2) 主題Topic (發行 接收) 3) WIFI ssid , password const char br...