LINE notify を使って画像ファイルを定期的に送りたい

ラズパイにUSBカメラを接続し、1時間毎に撮影した画像データをLINEを使って送りたいと考えています。
単純にインジェクトノード、momentノード、usbcameraノード、imageノードでラズパイ内には保存できるようになったのですが、LINE notifyノードに接続してもLINEに画像を送れません。
LINEに通知は来るのですが、日時データのみで画像が添付できません。不可能なのでしょうか?
LINEがいいのですが、他に画像を送る方法で良いものがあれば教えて頂ければありがたいです。

(The English version will be attached at the end.)

LINE notifyをサポートする2つのカスタムノード
https://flows.nodered.org/search?term=line-notify
は、どちらも、imageFileパラメータを使って直接画像をLINEに送れないです。
文面から、wtaro513さんは node-red-contrib-line-notify をお使いと推測します。このカスタムノードは、通知に含めたい画像は公開された画像URLで指定しますので、あらかじめRaspberry Piで取得した画像を、LINEがアクセスできるインターネット上に公開する必要があります。

1度のPOSTでメッセージデータと画像データを送るためには、 LINE Notify API Documentに記述がある「imageFile」パラメータを使って、POST時に"content-type": "multipart/form-data"形式でmsg.payloadを作ってhttp requestする必要があります。


Two custom nodes that support LINE notify
https://flows.nodered.org/search?term=line-notify
Neither can send images directly to LINE using the imageFile parameter.

From your post, I guess you are using [node-red-contrib-line-notify] (node-red-contrib-line-notify (node) - Node-RED). In this custom node, the image you want to include in the notification is specified by the published image URL, so you need to publish the image acquired with Raspberry Pi in advance on the Internet that LINE can access.

In order to send message data and image data in one POST, use the "imageFile" parameter described in [LINE Notify API Document]LINE Notify and use the "content-type": "multipart / form-data" format at the time of POST. You need to create msg.payload in and make an http request.

ご解答ありがとうございます。ただ私でチャレンジするにはハードルが高い内容のようです。
フローで例を作成して頂けないでしょうか。

とりあえず添付のFlowで、/home/pi/lineimage.png に置いたPNG画像ファイルを含んだNotifyを送信できました。
(Functionノードの中のTOKENを、ご自身のLine Notifyトークン文字列に置き換えてください)
(これ以上はサポートできません...)

[{"id":"f8520b99.0d75c","type":"inject","z":"fe7d9b9b.368ed8","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":220,"wires":[["82e67ef7.8ae8d8"]]},{"id":"ef6db0ec.8eb1c","type":"http request","z":"fe7d9b9b.368ed8","name":"LineNotifyに送信","method":"POST","ret":"txt","paytoqs":false,"url":"https://notify-api.line.me/api/notify","tls":"7ec9ecab.9bc5dc","persist":false,"proxy":"","authType":"","x":510,"y":400,"wires":[["fe2dc22e.d3047","92823616.94c0f8","d97f1b37.307ce8","71063f8b.7cd98"]]},{"id":"82e67ef7.8ae8d8","type":"file in","z":"fe7d9b9b.368ed8","name":"送信画像(PNGファイル指定)","filename":"/home/pi/lineimage.png","format":"","chunk":false,"sendError":false,"encoding":"none","x":200,"y":280,"wires":[["3b5832d2.1d6756"]]},{"id":"3b5832d2.1d6756","type":"function","z":"fe7d9b9b.368ed8","name":"メッセージ作成(TOKENを自分のトークンに置換)","func":"var img = msg.payload;\n\nmsg.payload = {\n    \"message\": \"テキストメッセージ\",\n    \"imageFile\": {\n        \"value\":img,\n        \"options\": {\n            \"filename\":\"lineimage.png\",\n            \"contentType\":\"image/png\"\n        }\n    }\n};\n\nmsg.headers = {\n    \"authorization\": \"Bearer TOKEN\",\n    \"content-type\": \"multipart/form-data\"\n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":340,"y":340,"wires":[["ef6db0ec.8eb1c"]]},{"id":"fe2dc22e.d3047","type":"debug","z":"fe7d9b9b.368ed8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":850,"y":260,"wires":[]},{"id":"92823616.94c0f8","type":"debug","z":"fe7d9b9b.368ed8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"headers","targetType":"msg","x":850,"y":300,"wires":[]},{"id":"d97f1b37.307ce8","type":"debug","z":"fe7d9b9b.368ed8","name":"残りNotify送信回数","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"headers[\"x-ratelimit-remaining\"]","targetType":"msg","x":830,"y":360,"wires":[]},{"id":"71063f8b.7cd98","type":"debug","z":"fe7d9b9b.368ed8","name":"残りイメージ送信回数","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"headers[\"x-ratelimit-imageremaining\"]","targetType":"msg","x":820,"y":400,"wires":[]},{"id":"7ec9ecab.9bc5dc","type":"tls-config","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","servername":"","verifyservercert":true}]

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.