# Payload and variables

**URL:** <https://discourse.nodered.org/t/payload-and-variables/38015>\
**Category:** General\
**Created:** [25 December 2020 21:03 UTC](https://discourse.nodered.org/t/payload-and-variables/38015 "2020-12-25T21:03:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![patfee](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/patfee/32/34216_2.png) [@patfee](https://discourse.nodered.org/u/patfee)\
**Post date:** [25 December 2020 21:03 UTC](https://discourse.nodered.org/t/payload-and-variables/38015/1 "2020-12-25T21:03:43Z")

</div>

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](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](http://192.168.1.77:5000/clips/%22camera%22-%22id%22.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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [25 December 2020 21:35 UTC](https://discourse.nodered.org/t/payload-and-variables/38015/2 "2020-12-25T21:35:09Z")

</div>

Welcome to the forum @patfee.

If you are an absolute beginner with node-red then start by watching the [node-red essentials](https://www.youtube.com/watch?v=ksGeUD26Mw0) videos.  
Then to help with the first requirement of building the filename read the [Working with Messages](https://nodered.org/docs/user-guide/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.

---

<div class="post-metadata">

**Author:** ![patfee](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/patfee/32/34216_2.png) [@patfee](https://discourse.nodered.org/u/patfee)\
**Post date:** [26 December 2020 06:14 UTC](https://discourse.nodered.org/t/payload-and-variables/38015/3 "2020-12-26T06:14:16Z")

</div>

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"}]`\>

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [26 December 2020 08:16 UTC](https://discourse.nodered.org/t/payload-and-variables/38015/4 "2020-12-26T08:16:42Z")

</div>

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.

> [@How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506):
>
> To share code samples or flow json in this forum, you need to take care to format it properly so that it is displayed correctly. The easiest way to do that is to click the 'Preformatted Text' button in the toolbar: [image] Then paste in your code or flow json. You should end up with three back-tick characters - ``` - on their own line before and after the code. On standard US English keyboards, this is on the same key as the ~ character. Using the backticks will ens…

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [26 December 2020 08:22 UTC](https://discourse.nodered.org/t/payload-and-variables/38015/5 "2020-12-26T08:22:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [24 February 2021 08:22 UTC](https://discourse.nodered.org/t/payload-and-variables/38015/6 "2021-02-24T08:22:58Z")

</div>

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