The elements you are trying to get are part of a string as they are red and between "".
You would need to JSON.parse() the msg.payload.options.reply_markup element to turn it into an object
it depends whether you are constructing this structure for a reason - for example, do you then pass this message to a particular node that expects this format?
When you stringify the property then the payload.options.reply_markup property is a single string. It doesn't have properties and you can't directly address the values inside it.
If you don't stringify the property then it is a JavaScript object and you can address all of its properties - such as payload.options.reply_markup.keyboard etc.
But if you are generating this message yourself in a Function node, then why do you need a Switch node to route it? Your Function node could have multiple outputs and you could add the logic in the Function node to choose which output it is sent on.
Without more information about what your wider flow looks like, its hard to be more specific.
Ok, let me if i get it. I have a function where i have two keyboard options to select from. Im ok with that. Whenever i select any of the options i want to clear that output so i can route the message to a GET node to my light, so i can turn them on or off.
So, with my actual examples, i understand that i dont need to Stringfy that keyboard options, is that correct?.
You have a function node that creates a message for telegram.
You send this message to a telegram node.
In telegram a keyboard will appear.
You choose a response option.
The telegram node will produce the response.
Connect the switch node to the telegram (response) node. (or depending on the type of telegram node, you might even have a telegram switch node that keeps track of the conversation).
payload.options.reply_markup.keyboard - will give you the 2 element array payload.options.reply_markup.keyboard[0] - will give you the first object in the array payload.options.reply_markup.keyboard[1]- will give you the second object in the array payload.options.reply_markup.keyboard[0][0] will give you the value of the object in the first array element. payload.options.reply_markup.keyboard[1][0] will give you the value of the object in the second array element.
But after reading all replys i still unsure to what you are doing.
Thanks for reply,
I want to get the payload or whatever from the telegram screen selection keyboard. When i touch a selection i want to capture that and make something with it.
So, the output is not giving me the right output...
I still dont know which contrib node that is, as there are multiple telegram nodes, but by the shear number of nodes I would expect some decent documentation. Are you using this one ? It includes a switch node, which is specifically for the purpose you are looking for. Also a lot of information and examples on that link, including keyboards+response handling.
And your debug output does not show the full debug output. (see the "object"s, which contains more information).
Use this icon to copy the complete payload: