I was able to use node red to send a photo message from scratch to my matrix home server. I used the home assistant camera api to get a binary buffer of the snapshot. Then I send an http request to my matrix server to login and get an access token. Next I upload the image to the matrix server and finally I post a message to a room using the image I just uploaded. What I would like to try next is see if I can use node red to encrypt the image sent to the matrix server. Here is the flow I ended up with that should help you to use as a guide to accomplish the same thing or something similar:
[{"id":"e50e094a.a9d4e8","type":"http request","z":"aa153788.b82028","name":"get image","method":"use","ret":"bin","url":"","tls":"","x":440,"y":640,"wires":[["5ddfa53d.dfc7bc"]]},{"id":"766b8dda.6e7794","type":"function","z":"aa153788.b82028","name":"get image","func":"delete msg.headers;\nmsg.method = 'GET';\nmsg.headers = {Authorization:\"Bearer HATOKEN\",\"Content-Type\":\"application/json\" };\nmsg.url = \"https://hass.server.com/api/camera_proxy/camera.mycam\"\nreturn msg;","outputs":1,"noerr":0,"x":280,"y":640,"wires":[["e50e094a.a9d4e8"]]},{"id":"5ddfa53d.dfc7bc","type":"change","z":"aa153788.b82028","name":"photo & time","rules":[{"t":"move","p":"payload","pt":"msg","to":"photo","tot":"msg"},{"t":"set","p":"time","pt":"msg","to":"$now()","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":130,"y":740,"wires":[["c2e68636.4dcb48"]]},{"id":"c07e3d7.c0695c","type":"function","z":"aa153788.b82028","name":"post image","func":"delete msg.headers;\nmsg.token = msg.payload.access_token;\nmsg.payload = msg.photo;\nmsg.method = 'POST';\nmsg.headers = {Authorization:\"Bearer \" + msg.token,\"Content-Type\":\"application/json\"}\nmsg.url = \"https://matrix.server.com/_matrix/media/r0/upload?filename=\" + msg.time + \"-mycamimage.jpg\";\nreturn msg;","outputs":1,"noerr":0,"x":710,"y":780,"wires":[["a914b253.ca53f"]]},{"id":"a914b253.ca53f","type":"http request","z":"aa153788.b82028","name":"post image","method":"use","ret":"obj","url":"","tls":"","x":890,"y":780,"wires":[["2791a9c3.a11506"]]},{"id":"2791a9c3.a11506","type":"function","z":"aa153788.b82028","name":"put image","func":"delete msg.headers;\ndelete msg.photo;\ndelete msg.thumb;\nmsg.photo_uri = msg.payload.content_uri;\n\ndelete msg.topic;\nmsg.method = 'PUT';\nmsg.headers = {Authorization:\"Bearer \" + msg.token,\"Content-Type\":\"application/json\"};\nmsg.url = \"https://matrix.server.com/_matrix/client/r0/rooms/%21ROOMID%3Amatrix.server.com/send/m.room.message/\" + msg.random;\nmsg.payload = {body:\"Camera Snapshot\",msgtype:\"m.image\",url:msg.photo_uri,info:{h:1080,w:1920,mimetype:\"image/jpeg\"}};\ndelete msg.photo_uri;\ndelete msg.random;\nreturn msg;","outputs":1,"noerr":0,"x":180,"y":860,"wires":[["4ccb334d.691cdc"]]},{"id":"4ccb334d.691cdc","type":"http request","z":"aa153788.b82028","name":"http","method":"use","ret":"obj","url":"","tls":"","x":390,"y":860,"wires":[[]]},{"id":"8ac07cbe.e955","type":"random","z":"aa153788.b82028","name":"","low":"1","high":"1000000000","inte":"true","property":"random","x":120,"y":640,"wires":[["766b8dda.6e7794"]]},{"id":"c2e68636.4dcb48","type":"function","z":"aa153788.b82028","name":"post login","func":"delete msg.headers;\nmsg.payload = {\"type\":\"m.login.password\", \"user\":\"@my_bot:matrix.server.com\", \"password\":\"mybotpassword\", \"device_id\":\"BOEBPWVQRE\", \"initial_device_display_name\":\"node_red\"};\nmsg.method = 'POST';\nmsg.url = \"https://matrix.cmart.tech/_matrix/client/r0/login\";\nreturn msg;","outputs":1,"noerr":0,"x":300,"y":740,"wires":[["f07ba4b5.e2a768"]]},{"id":"f07ba4b5.e2a768","type":"http request","z":"aa153788.b82028","name":"post login","method":"use","ret":"obj","url":"","tls":"","x":500,"y":760,"wires":[["c07e3d7.c0695c"]]}]
EDIT: Make up your own device_id. That way each time node red logs in and retrieves an access_token it will replace the access_token of the device id you put. I have since added the credentials node to my flow before the login request so that the matrix username and password aren’t stored in plain text