[{"id":"20636f59.fed13","type":"telegram event","z":"ed43e0f7.31d9","name":"","bot":"fcc25e57.4073a","event":"callback_query","autoanswer":true,"x":120,"y":160,"wires":[["f0a3c788.7bbb18"]]},{"id":"d0ae190d.071828","type":"telegram sender","z":"ed43e0f7.31d9","name":"show inline keyboard","bot":"fcc25e57.4073a","haserroroutput":false,"outputs":1,"x":562.7594223022461,"y":53.30331039428711,"wires":[["23220303.4a427c"]]},{"id":"3426758a.a2d09a","type":"function","z":"ed43e0f7.31d9","name":"initial inline keyboard message","func":"context.global.keyboard = { messageId : msg.payload.messageId };\n\nvar opts = {\n reply_to_message_id: msg.payload.messageId,\n reply_markup: JSON.stringify({\n \"inline_keyboard\": [[\n {\n \"text\": \"Yes\",\n \"callback_data\": \"FOO YES\" \n }, \n {\n \"text\": \"No\",\n \"callback_data\": \"FOO NO\" \n }]\n ]\n })\n};\n\nmsg.payload.content = 'Do you want to hide the inline keyboard?';\nmsg.payload.options = opts;\n\nreturn [ msg ];\n","outputs":"1","noerr":0,"x":301.7592468261719,"y":54.3032283782959,"wires":[["d0ae190d.071828"]]},{"id":"d7bfbd4.da4e34","type":"telegram command","z":"ed43e0f7.31d9","name":"/foo","command":"/foo","bot":"fcc25e57.4073a","strict":false,"hasresponse":false,"useregex":false,"removeregexcommand":false,"outputs":1,"x":82.75931549072266,"y":60.30321025848389,"wires":[["3426758a.a2d09a"]]},{"id":"43cecef5.e2e93","type":"function","z":"ed43e0f7.31d9","name":"YES REALLY","func":"// Hide the keyboard and forget the messageId\nmsg.payload.type = 'deleteMessage';\nmsg.payload.content = context.global.keyboard.messageId\ncontext.global.keyboard.messageId = null;\n\n// You could also send a editMessageReplyMarkup with an empty reply_markup here\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":560,"y":160,"wires":[["8e746981.f48368"]]},{"id":"8e746981.f48368","type":"telegram sender","z":"ed43e0f7.31d9","name":"","bot":"fcc25e57.4073a","haserroroutput":false,"outputs":1,"x":790,"y":160,"wires":[["2e9b911.c6c726e"]]},{"id":"2c6089c4.883006","type":"function","z":"ed43e0f7.31d9","name":"YES","func":"// This is the message id of the initial keyboard that is simply exchanged by a new one.\nvar messageId = context.global.keyboard.messageId;\n\n// This is a sample of how to send a second inline keyboard with modified buttons\nvar reply_markup = JSON.stringify({\n \"inline_keyboard\": [[\n {\n \"text\": \"Are you really sure?\",\n \"callback_data\": \"FOO YES REALLY\" \n }, \n {\n \"text\": \"No\",\n \"callback_data\": \"FOO NO\" \n }]\n ]\n });\n\n\nvar options = {\n chat_id : msg.payload.chatId,\n reply_markup : reply_markup,\n message_id : messageId\n};\n\nmsg.payload.type = 'editMessageReplyMarkup';\nmsg.payload.content = reply_markup;\nmsg.payload.options = options;\n\nreturn [ msg ];\n","outputs":"1","noerr":0,"initialize":"","finalize":"","x":530,"y":120,"wires":[["8e746981.f48368"]]},{"id":"23220303.4a427c","type":"function","z":"ed43e0f7.31d9","name":"save messageId","func":"// We store the messageId to be able to edit this reply in the callback query. \ncontext.global.keyboard.messageId = msg.payload.sentMessageId;\nreturn [ msg ];\n","outputs":"1","noerr":0,"x":780.6667861938477,"y":53.66671276092529,"wires":[[]]},{"id":"2e9b911.c6c726e","type":"debug","z":"ed43e0f7.31d9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1030,"y":160,"wires":[]},{"id":"f0a3c788.7bbb18","type":"switch","z":"ed43e0f7.31d9","name":"check callback data","property":"payload.content","propertyType":"msg","rules":[{"t":"eq","v":"FOO YES","vt":"str"},{"t":"eq","v":"FOO YES REALLY","vt":"str"},{"t":"eq","v":"FOO NO","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":330,"y":160,"wires":[["2c6089c4.883006"],["43cecef5.e2e93"],["8e23029e.001b7"]]},{"id":"8e23029e.001b7","type":"function","z":"ed43e0f7.31d9","name":"NO","func":"var show_alert = true; // you can set this to true to open a dialog with the answer in the client.\n\n// msg.payload.content contains the callback data from the keyboard.\n// You may change this value here.\nmsg.payload.options = show_alert;\n\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":530,"y":200,"wires":[["8e746981.f48368"]]},{"id":"fcc25e57.4073a","type":"telegram bot","botname":"HeinzBot","usernames":"","chatids":"","baseapiurl":"","updatemode":"polling","pollinterval":"300","usesocks":false,"sockshost":"","socksport":"6667","socksusername":"anonymous","sockspassword":"","bothost":"","botpath":"","localbotport":"8443","publicbotport":"8443","privatekey":"","certificate":"","useselfsignedcertificate":false,"sslterminated":false,"verboselogging":false}]