Send an image and message to the Line Notify API via an HTTP request

This program incorporates the following features:

  1. Data Configuration: In the provided example, data is structured into three formats: sending images, sending text, and sending stickers.

  2. Data Formatting: The program intelligently formats the data according to the specific requirements of each format, ensuring it resides within the payload.

  3. Data Transmission: The formatted data is then transmitted to the Line Notify API.

contact me or follow me : https://www.facebook.com/profile.php?id=61550015338310

[{"id":"0d3baac43d9991a7","type":"group","z":"7828df7216a672fb","name":"1","style":{"label":true},"nodes":["b0c68c2b48706bdf","00ea591d87af04d3","d9d9df13e53dee6c","92817fac6de34d43"],"x":74,"y":39,"w":392,"h":162},{"id":"b0c68c2b48706bdf","type":"inject","z":"7828df7216a672fb","g":"0d3baac43d9991a7","name":"","props":[{"p":"token","v":"Bearer YOUR_ACCESS_TOKEN","vt":"str"},{"p":"filename","v":"/data/cat.jpg","vt":"str"},{"p":"contentType","v":"image/jpg","vt":"str"},{"p":"message","v":"zzzzzzzzzzzzzzzzz","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Send Image ","x":190,"y":80,"wires":[["00ea591d87af04d3"]]},{"id":"00ea591d87af04d3","type":"file in","z":"7828df7216a672fb","g":"0d3baac43d9991a7","name":"","filename":"filename","filenameType":"msg","format":"","chunk":false,"sendError":false,"encoding":"none","allProps":false,"x":380,"y":80,"wires":[["6e6535b69287bf6a"]]},{"id":"d9d9df13e53dee6c","type":"inject","z":"7828df7216a672fb","g":"0d3baac43d9991a7","name":"","props":[{"p":"token","v":"Bearer YOUR_ACCESS_TOKEN","vt":"str"},{"p":"message","v":"zzzzzzzzzzzzzzzzz","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Send Message","x":200,"y":120,"wires":[["1dc2f97e1eaa41dc"]]},{"id":"92817fac6de34d43","type":"inject","z":"7828df7216a672fb","g":"0d3baac43d9991a7","name":"","props":[{"p":"token","v":"Bearer YOUR_ACCESS_TOKEN","vt":"str"},{"p":"message","v":"zzzzzzzzzzzzzzzzz","vt":"str"},{"p":"topic","vt":"str"},{"p":"stickerPackageId","v":"11538","vt":"str"},{"p":"stickerId","v":"51626495","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"Send Sticker","x":190,"y":160,"wires":[["ae49c517477bf1a3"]]},{"id":"8cbbcb19bbd7f4d2","type":"group","z":"7828df7216a672fb","name":"2","style":{"label":true},"nodes":["6e6535b69287bf6a","6d72cdce72f03ef0","1dc2f97e1eaa41dc","ae49c517477bf1a3","9b2073fc64d7683c","be5e69024284c688"],"x":494,"y":39,"w":432,"h":162},{"id":"6e6535b69287bf6a","type":"function","z":"7828df7216a672fb","g":"8cbbcb19bbd7f4d2","name":"set payload","func":"msg.payload = {\n    message: msg.message,\n    imageFile: {\n        value: msg.payload,\n        options: {\n            filename: msg.filename,\n            contentType: msg.contentType,\n        }\n    }\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":590,"y":80,"wires":[["6d72cdce72f03ef0","f220f5b57d712468"]]},{"id":"6d72cdce72f03ef0","type":"debug","z":"7828df7216a672fb","g":"8cbbcb19bbd7f4d2","name":"Send Image","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":790,"y":80,"wires":[]},{"id":"1dc2f97e1eaa41dc","type":"function","z":"7828df7216a672fb","g":"8cbbcb19bbd7f4d2","name":"set payload","func":"msg.payload = {\n    message: msg.message,\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":590,"y":120,"wires":[["f220f5b57d712468","9b2073fc64d7683c"]]},{"id":"ae49c517477bf1a3","type":"function","z":"7828df7216a672fb","g":"8cbbcb19bbd7f4d2","name":"set payload","func":"msg.payload = {\n    message: msg.message,\n    stickerPackageId: msg.stickerPackageId,\n    stickerId: msg.stickerId,\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":590,"y":160,"wires":[["f220f5b57d712468","be5e69024284c688"]]},{"id":"9b2073fc64d7683c","type":"debug","z":"7828df7216a672fb","g":"8cbbcb19bbd7f4d2","name":"Send Message","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":800,"y":120,"wires":[]},{"id":"be5e69024284c688","type":"debug","z":"7828df7216a672fb","g":"8cbbcb19bbd7f4d2","name":"Send Sticker","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":790,"y":160,"wires":[]},{"id":"f821547382f72e5b","type":"group","z":"7828df7216a672fb","name":"3","style":{"label":true},"nodes":["f220f5b57d712468","5e0b0680eae3e0e5"],"x":994,"y":79,"w":392,"h":82},{"id":"f220f5b57d712468","type":"http request","z":"7828df7216a672fb","g":"f821547382f72e5b","name":"notify-api","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://notify-api.line.me/api/notify","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[{"keyType":"other","keyValue":"Content-Type","valueType":"other","valueValue":"multipart/form-data"},{"keyType":"other","keyValue":"Authorization","valueType":"msg","valueValue":"token"}],"x":1080,"y":120,"wires":[["5e0b0680eae3e0e5"]]},{"id":"5e0b0680eae3e0e5","type":"debug","z":"7828df7216a672fb","g":"f821547382f72e5b","name":"debug notify-api","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1260,"y":120,"wires":[]}]

Flow Info

Created 1 year, 9 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • debug (x4)
  • file in (x1)
  • function (x3)
  • http request (x1)
  • inject (x3)
Other

Tags

  • line
  • notify
  • api
  • HTTP request
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option