Telegram on reply node payload

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.

[
    {
        "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
    }
]

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

See the built in demos...

CTRL-I

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

1 Like

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.

[{"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


After selecting yes

2 Likes

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

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