# Telegram on reply node payload

**URL:** <https://discourse.nodered.org/t/telegram-on-reply-node-payload/69486>\
**Category:** General\
**Created:** [24 October 2022 10:58 UTC](https://discourse.nodered.org/t/telegram-on-reply-node-payload/69486 "2022-10-24T10:58:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Enz0Jacco](https://avatars.discourse-cdn.com/v4/letter/e/e99b99/32.png) [@Enz0Jacco](https://discourse.nodered.org/u/Enz0Jacco)\
**Post date:** [24 October 2022 10:58 UTC](https://discourse.nodered.org/t/telegram-on-reply-node-payload/69486/1 "2022-10-24T10:58:56Z")

</div>

hey guys,  
just a quick question I guess about the telegram on reply node.  
the idea is to send me a message when the lights are still on at 8PM with the question if I want to turn them off.  
I do receive the message but the reply is not noticed by the reply node. the only thing I can think of is that there something wrong with the payload in the function node.  
Hope you guys can help me.

```auto
[
    {
        "id": "4efa66c647b6a5d2",
        "type": "tab",
        "label": "Flow 2",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "94e6c6a37ead33c3",
        "type": "inject",
        "z": "4efa66c647b6a5d2",
        "name": "@ 20:00",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "00 20 * * *",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "ON",
        "payloadType": "str",
        "x": 120,
        "y": 180,
        "wires": [
            [
                "83590f1f3671fa9d"
            ]
        ]
    },
    {
        "id": "83590f1f3671fa9d",
        "type": "switch",
        "z": "4efa66c647b6a5d2",
        "name": "Bedlamp aan",
        "property": "Big_Bedroom_Bedlight",
        "propertyType": "global",
        "rules": [
            {
                "t": "eq",
                "v": "ON",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 270,
        "y": 180,
        "wires": [
            [
                "6164b2f6f8a972ab"
            ]
        ]
    },
    {
        "id": "f10fc8340d3ab77e",
        "type": "telegram reply",
        "z": "4efa66c647b6a5d2",
        "name": "get reply",
        "bot": "01444d293b516083",
        "x": 780,
        "y": 180,
        "wires": [
            [
                "2a1c3cd8afcf5737"
            ]
        ]
    },
    {
        "id": "e859102b524c4d39",
        "type": "telegram sender",
        "z": "4efa66c647b6a5d2",
        "name": "Send question",
        "bot": "01444d293b516083",
        "haserroroutput": false,
        "outputs": 1,
        "x": 620,
        "y": 180,
        "wires": [
            [
                "f10fc8340d3ab77e"
            ]
        ]
    },
    {
        "id": "2a1c3cd8afcf5737",
        "type": "function",
        "z": "4efa66c647b6a5d2",
        "name": "switch answer",
        "func": "if(msg.payload.content === 'Yes')\n{\n return [msg, null]; \n}\nelse\n{\n return [null, msg]; \n}\n",
        "outputs": "2",
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 940,
        "y": 180,
        "wires": [
            [],
            []
        ]
    },
    {
        "id": "6164b2f6f8a972ab",
        "type": "function",
        "z": "4efa66c647b6a5d2",
        "name": "create question",
        "func": "msg.payload = {\n \"chatId\": xxx, // << set to chat id\n \"type\": \"message\",\n \"content\": \"Moet het licht bij Féline uit?\",\n \"options\": {reply_to_message_id: msg.payload.messageId}\n}\nreturn msg;",
        "outputs": "1",
        "noerr": 1,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 440,
        "y": 180,
        "wires": [
            [
                "e859102b524c4d39"
            ]
        ]
    },
    {
        "id": "01444d293b516083",
        "type": "telegram bot",
        "botname": "openhabbey_bot",
        "usernames": "Enz0jacco",
        "chatids": "xxx",
        "baseapiurl": "",
        "updatemode": "polling",
        "pollinterval": "300",
        "usesocks": false,
        "sockshost": "",
        "socksprotocol": "socks5",
        "socksport": "6667",
        "socksusername": "anonymous",
        "sockspassword": "",
        "bothost": "",
        "botpath": "",
        "localbotport": "8443",
        "publicbotport": "8443",
        "privatekey": "",
        "certificate": "",
        "useselfsignedcertificate": false,
        "sslterminated": false,
        "verboselogging": true
    }
]

```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [24 October 2022 11:25 UTC](https://discourse.nodered.org/t/telegram-on-reply-node-payload/69486/2 "2022-10-24T11:25:22Z")

</div>

I think a keyboard would be better suited in this scenario...

See the built in demos...

CTRL-I

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/1/b1ca716d1867a6966dec376156da45edee5e2bdb.png)

---

<div class="post-metadata">

**Author:** ![dynamicdave](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dynamicdave/32/96_2.png) [@dynamicdave](https://discourse.nodered.org/u/dynamicdave)\
**Post date:** [24 October 2022 12:17 UTC](https://discourse.nodered.org/t/telegram-on-reply-node-payload/69486/3 "2022-10-24T12:17:01Z")

</div>

I agree with @Steve-Mcl that Telegram's inline keyboard feature would probably be a good solution.  
Here's an example of an inline keyboard to turn my IKEA light on/off.

![inline](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/0/10bcec386a0190c1a5780e6bf8a29776eb0a1030.png)

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [24 October 2022 12:45 UTC](https://discourse.nodered.org/t/telegram-on-reply-node-payload/69486/4 "2022-10-24T12:45:52Z")

</div>

I think a keyboard would be a better option, as it can be removed after the reply rather than a inline keyboard, which does not have a one time option.  
eg.

```auto
[{"id":"94e6c6a37ead33c3","type":"inject","z":"4efa66c647b6a5d2","name":"@ 20:00","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"ON","payloadType":"str","x":300,"y":180,"wires":[["83590f1f3671fa9d"]]},{"id":"83590f1f3671fa9d","type":"switch","z":"4efa66c647b6a5d2","name":"Bedlamp aan","property":"Big_Bedroom_Bedlight","propertyType":"global","rules":[{"t":"eq","v":"ON","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":250,"y":240,"wires":[["2c2e5956.54b846"]]},{"id":"2c2e5956.54b846","type":"function","z":"4efa66c647b6a5d2","name":"build keyboard","func":"msg.payload = {};\nlet opts = {\n reply_markup: JSON.stringify({\n \"keyboard\": [[\n \"Yes\"\n],[\n \"No\"\n]],\n 'resize_keyboard' : true, \n 'one_time_keyboard' : true,\n \"input_field_placeholder\": \"Moet het licht bij Féline uit?\"\n })\n};\nmsg.error = false;\nmsg.payload.content = 'Moet het licht bij Féline uit?';\nmsg.payload.options = opts;\nmsg.payload.chatId = -1001361034082;\nmsg.payload.type = \"message\";\nreturn msg;\n","outputs":"1","noerr":0,"initialize":"","finalize":"","libs":[],"x":440,"y":240,"wires":[["c8a8015.60267"]]},{"id":"c8a8015.60267","type":"telegram sender","z":"4efa66c647b6a5d2","name":"","bot":"2199975104e81aee","haserroroutput":false,"outputs":1,"x":690,"y":240,"wires":[["d719b18b.da75f8"]]},{"id":"0dd22e402b274663","type":"change","z":"4efa66c647b6a5d2","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\t\"chatId\": $$.payload.chatId,\t\"type\": \"message\",\t\"content\": $$.payload.content\t}","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":340,"wires":[["c8a8015.60267","d719b18b.da75f8"]]},{"id":"d719b18b.da75f8","type":"debug","z":"4efa66c647b6a5d2","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":690,"y":460,"wires":[]},{"id":"d7f1c6399aef5c6b","type":"change","z":"4efa66c647b6a5d2","name":"","rules":[{"t":"set","p":"payload.content","pt":"msg","to":"action yes taken","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":320,"wires":[["0dd22e402b274663"]]},{"id":"cab5caa1d2a8a495","type":"change","z":"4efa66c647b6a5d2","name":"","rules":[{"t":"set","p":"payload.content","pt":"msg","to":"action no taken","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":570,"y":360,"wires":[["0dd22e402b274663"]]},{"id":"d685b62cb4c8af2a","type":"telegram receiver","z":"4efa66c647b6a5d2","name":"","bot":"2199975104e81aee","saveDataDir":"","filterCommands":false,"x":230,"y":340,"wires":[["d719b18b.da75f8","9040dd51a57b6879"],[]]},{"id":"9040dd51a57b6879","type":"switch","z":"4efa66c647b6a5d2","name":"","property":"payload.content","propertyType":"msg","rules":[{"t":"eq","v":"Yes","vt":"str"},{"t":"eq","v":"No","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":390,"y":340,"wires":[["d7f1c6399aef5c6b"],["cab5caa1d2a8a495"]]},{"id":"2199975104e81aee","type":"telegram bot","botname":"elcidtestbot","usernames":"","chatids":"-1001361034082","baseapiurl":"","updatemode":"polling","pollinterval":"300","usesocks":false,"sockshost":"","socksprotocol":"socks5","socksport":"6667","socksusername":"anonymous","sockspassword":"","bothost":"","botpath":"","localbotport":"8443","publicbotport":"8443","privatekey":"","certificate":"","useselfsignedcertificate":false,"sslterminated":false,"verboselogging":false}]

```

Keyboard

 ![image1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/6/c61985e98a456bab22e259839b62768e2b19e35f.jpeg)  
After selecting yes  
 ![image2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/4/a4a63c1dd512dba1115db5cbf2f184f239a152c8.jpeg)

---

<div class="post-metadata">

**Author:** ![Enz0Jacco](https://avatars.discourse-cdn.com/v4/letter/e/e99b99/32.png) [@Enz0Jacco](https://discourse.nodered.org/u/Enz0Jacco)\
**Post date:** [24 October 2022 13:25 UTC](https://discourse.nodered.org/t/telegram-on-reply-node-payload/69486/5 "2022-10-24T13:25:30Z")

</div>

works perfectly! thank you so much for the quick replies!

---

<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:** [7 November 2022 13:26 UTC](https://discourse.nodered.org/t/telegram-on-reply-node-payload/69486/6 "2022-11-07T13:26:21Z")

</div>

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