dockerized_openAger/nodered/rootfs/data/node_modules/node-red-contrib-telegrambot/examples/sendkeyboardtochat.json

1 line
2.1 KiB
JSON
Raw Permalink Normal View History

2020-10-17 16:42:50 +00:00
[{"id":"d69380f4.8f204","type":"function","z":"3068ac13.951064","name":"create response","func":"if(context.global.keyboard.pending)\n{\n context.global.keyboard.pending = false;\n \n if(msg.payload.content === 'Yes')\n {\n msg.payload.content = 'Yes';\n return [msg, null]; \n }\n else\n {\n msg.payload.content = 'No';\n return [null, msg]; \n }\n}\n","outputs":"2","noerr":0,"x":335.0000457763672,"y":135.0000343322754,"wires":[["c9c5ff32.8db61"],[]]},{"id":"c9c5ff32.8db61","type":"telegram sender","z":"3068ac13.951064","name":"sender","bot":"6cc03fc7.9b8fb","x":529.0000991821289,"y":108.0000228881836,"wires":[[]]},{"id":"44bd3c3f.c0a614","type":"inject","z":"3068ac13.951064","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":99.16667175292969,"y":43,"wires":[["a293fe2.aa058"]]},{"id":"e936d5da.8433f8","type":"telegram receiver","z":"3068ac13.951064","name":"receiver","bot":"6cc03fc7.9b8fb","saveDataDir":"","x":89.16667175292969,"y":140.33334732055664,"wires":[["d69380f4.8f204"],[]]},{"id":"a293fe2.aa058","type":"function","z":"3068ac13.951064","name":"create keyboard message","func":"// Here you must adapt the chatId.\nvar chatId = 123;\n\ncontext.global.keyboard = { pending : true };\n\nvar opts = {\n reply_to_message_id: 0,\n reply_markup: JSON.stringify({\n keyboard: [\n ['Yes'],\n ['No']],\n 'resize_keyboard' : true, \n 'one_time_keyboard' : true\n })\n};\n\nvar payload = {\n chatId : chatId,\n type : 'message',\n content : 'Really?',\n options : opts,\n};\n\n\nmsg.payload = payload;\nreturn [ msg ];","outputs":1,"noerr":0,"x":304.16668701171875,"y":44,"wires":[["c9c5ff32.8db61"]]},{"id":"6cc03fc7.9b8fb","type":"telegram bot","z":"","botname":"HeinzBot","usernames":"Windhose","chatids":"","baseapiurl":"","updatemode":"polling","pollinterval":"300","usesocks":false,"sockshost":"","socksport":"6667","socksusername":"anonymous","sockspassword":"","bothost":"","localbotport":"8443","publicbotport":"8443","privatekey":"","certificate":"","useselfsignedcertificate":false,"verboselogging":false}]