2019年11月30日 星期六

NODE-RED + LINE NOTIFY MASSAGE

NODE-RED + LINE NOTIFY MASSAGE


http://noobembedded.blogspot.com/2018/07/node-red-line-api.html


  • create inject  by  create massage  string for send to Line Notify 


  • create function Set Line API


  • For format Line massage Header
    'content-type':'application/x-www-form-urlencoded','Authorization':'Bearer OKW0QlpccUbnkzyVKMqCwnPUELrxfVbPMs7LfGQjkSv'

    By OKW0QlpccUbnkzyVKMqCwnPUELrxfVbPMs7LfGQjkSv is API KEY
    can be generate by  https://notify-bot.line.me/en/

    And create massage to  msg.payload
    msg.payload = {"message":msg.payload};



  •  crate http request to flow


  • by setting POST Method , URL to https://notify-api.line.me/api/notify

  •  create debug for view massage response

  • if  function complete  Line Notify will show massage  and debug
     status":200,"message":"ok







[{"id":"53b696d9.a48d08","type":"inject","z":"58734155.f17b4","name":"","topic":"","payload":"Node-red send Line Massage","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":220,"wires":[["6bd49f9.c916d6"]]},{"id":"6bd49f9.c916d6","type":"function","z":"58734155.f17b4","name":"Set Line API ","func":"msg.headers = {'content-type':'application/x-www-form-urlencoded','Authorization':'Bearer cEI4hx24xyopKGAArgZcKJNHE1V7KeeIi4Lzny3dDNO'};\nmsg.payload = {\"message\":msg.payload};\nreturn msg;","outputs":1,"noerr":0,"x":250,"y":220,"wires":[["75e93e42.4fae8"]]},{"id":"75e93e42.4fae8","type":"http request","z":"58734155.f17b4","name":"","method":"POST","ret":"txt","url":"https://notify-api.line.me/api/notify","tls":"","x":450,"y":220,"wires":[["a3fd0ba1.ae8e48"]]},{"id":"a3fd0ba1.ae8e48","type":"debug","z":"58734155.f17b4","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":650,"y":220,"wires":[]}]

沒有留言:

張貼留言

2024產專班 作業2 (純模擬)

2024產專班 作業2  (純模擬) 1) LED ON,OFF,TIMER,FLASH 模擬 (switch 控制) 2)RFID卡號模擬 (buttom  模擬RFID UID(不從ESP32) Node-Red 程式 [{"id":"d8886...