Payload and variables

completely puzzeled and hoping someone could point me in the right direction.

i receive a mqtt message which is converted in an json object.
the actual mqtt is a frigate/events message, and the son object has a "camera" and "id"

i want to use these two values to compile a video filename:.
http://192.168.1.77:5000/clips/bdc_frigate-1608924525.93887-ngdahq.mp4
bdc_frigate is the "camera"
1608924525.93887-ngdahq is the "id"

with that i want to make the movie available using the "http request" node.
address to be used is:
http://192.168.1.77:5000/clips/"camera"-"id".mp4

Then i want to use that file in the a function used to send a telegram sender
msg.payload = {
chatId: 11111111,
type: 'video',
caption : 'You must have a look at this!',
content: msg.payload,
}
where the msg.payload is the outcome of the http request

struggeling for a couple of days now and hoping someone could point me in the right direction.

many thanks

Welcome to the forum @patfee.

If you are an absolute beginner with node-red then start by watching the node-red essentials videos.
Then to help with the first requirement of building the filename read the Working with Messages page from the docs.

To work towards solving your problem start at the beginning and work out how to build the filename. The template node (not the ui-template) may be helpful here.

thats exactly my problem

"statically" it works with the following flow but I can't figure out how to compile the filename. don't see how I could use the filename either?

<[{"id":"6eaaeada.8cda3c","type":"mqtt in","z":"ed123003.62d77","name":"frigate/events","topic":"frigate/events","qos":"2","datatype":"auto","broker":"77a96594.e33e9c","x":270,"y":620,"wires":[["7358db7e.c2dfdc"]]},{"id":"7358db7e.c2dfdc","type":"json","z":"ed123003.62d77","name":"test","property":"payload","action":"","pretty":false,"x":490,"y":620,"wires":[["9b33a525.55e91"]]},{"id":"9b33a525.55e91","type":"switch","z":"ed123003.62d77","name":"start switch","property":"payload.after.end_time","propertyType":"msg","rules":[{"t":"nnull"}],"checkall":"true","repair":false,"outputs":1,"x":670,"y":620,"wires":[["6fe7b56e.fa1b34"]]},{"id":"29cd1ef8.cf2b12","type":"chatbot-telegram-send","z":"ed123003.62d77","bot":"8fc57b69.702da8","botProduction":"","track":false,"passThrough":false,"errorOutput":false,"outputs":0,"x":1210,"y":620,"wires":[]},{"id":"6fe7b56e.fa1b34","type":"http request","z":"ed123003.62d77","name":"","method":"GET","ret":"bin","paytoqs":"ignore","url":"http://192.168.1.77:5000/clips/fdc_frigate-1608878400.746213-qdxlgl.mp4","tls":"","persist":false,"proxy":"","authType":"","x":830,"y":620,"wires":[["e05cdd98.beccd"]]},{"id":"e05cdd98.beccd","type":"function","z":"ed123003.62d77","name":"","func":"msg.payload = {\n chatId: 111111111,\n type: 'video',\n caption : 'You must have a look at this!',\n content: msg.payload,\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1030,"y":620,"wires":[["29cd1ef8.cf2b12"]]},{"id":"77a96594.e33e9c","type":"mqtt-broker","name":"Eclips Mosquito","broker":"192.168.1.77","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"8fc57b69.702da8","type":"chatbot-telegram-node","botname":"steenbank_cam","usernames":"","providerToken":"","polling":"1000","store":"","log":"","debug":false,"webHook":"","connectMode":"polling"}]>

Please see this post for how to paste a flow here, so that it can easily be imported. You can edit your previous post to fix the problem.

Also, did you watch the videos, read the page I linked to and look at the help text for template node? I don't see a template node in your flow.
If you tell the mqtt node to parse the data as JSON then you can remove the JSON node.

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