[{"id":"20636f59.fed13","type":"telegram event","z":"a4fc2021eddfd308","name":"","bot":"65ca12172854cc2d","event":"callback_query","autoanswer":true,"x":120,"y":440,"wires":[["f0a3c788.7bbb18"]]},{"id":"d0ae190d.071828","type":"telegram sender","z":"a4fc2021eddfd308","name":"show inline keyboard","bot":"65ca12172854cc2d","haserroroutput":false,"outputs":1,"x":562.7594223022461,"y":333.3033103942871,"wires":[["23220303.4a427c"]]},{"id":"3426758a.a2d09a","type":"function","z":"a4fc2021eddfd308","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":334.3032283782959,"wires":[["d0ae190d.071828"]]},{"id":"d7bfbd4.da4e34","type":"telegram command","z":"a4fc2021eddfd308","name":"/foo","command":"/foo","description":"","registercommand":false,"language":"","bot":"65ca12172854cc2d","strict":false,"hasresponse":false,"useregex":false,"removeregexcommand":false,"outputs":1,"x":82.75931549072266,"y":340.3032102584839,"wires":[["3426758a.a2d09a"]]},{"id":"43cecef5.e2e93","type":"function","z":"a4fc2021eddfd308","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,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":560,"y":440,"wires":[["8e746981.f48368"]]},{"id":"8e746981.f48368","type":"telegram sender","z":"a4fc2021eddfd308","name":"","bot":"65ca12172854cc2d","haserroroutput":false,"outputs":1,"x":790,"y":440,"wires":[["2e9b911.c6c726e"]]},{"id":"2c6089c4.883006","type":"function","z":"a4fc2021eddfd308","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","timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":530,"y":400,"wires":[["8e746981.f48368"]]},{"id":"23220303.4a427c","type":"function","z":"a4fc2021eddfd308","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":333.6667127609253,"wires":[[]]},{"id":"2e9b911.c6c726e","type":"debug","z":"a4fc2021eddfd308","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1030,"y":440,"wires":[]},{"id":"f0a3c788.7bbb18","type":"switch","z":"a4fc2021eddfd308","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":440,"wires":[["2c6089c4.883006"],["43cecef5.e2e93"],["8e23029e.001b7"]]},{"id":"8e23029e.001b7","type":"function","z":"a4fc2021eddfd308","name":"NO","func":"msg.payload.type = 'answerCallbackQuery';\nmsg.payload.options = {\n text : msg.payload.content,\n show_alert : true, // you can set this to true to open a dialog with the answer in the client.\n};\n\nreturn msg;\n\n","outputs":1,"timeout":"","noerr":0,"initialize":"","finalize":"","libs":[],"x":530,"y":480,"wires":[["8e746981.f48368"]]},{"id":"65ca12172854cc2d","type":"telegram bot","botname":"HeinzBot","usernames":"","chatids":"","baseapiurl":"","testenvironment":false,"updatemode":"polling","pollinterval":"1000","usesocks":false,"sockshost":"","socksprotocol":"socks5","socksport":"1080","socksusername":"","sockspassword":"","bothost":"","botpath":"","localbotport":"8443","publicbotport":"8443","privatekey":"","certificate":"","useselfsignedcertificate":false,"sslterminated":true,"verboselogging":true}]