# Telegram Inline keyboard

**URL:** <https://discourse.nodered.org/t/telegram-inline-keyboard/67587>\
**Category:** General\
**Created:** [11 September 2022 22:02 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard/67587 "2022-09-11T22:02:37Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marty1982](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marty1982/32/20162_2.png) [@Marty1982](https://discourse.nodered.org/u/Marty1982)\
**Post date:** [11 September 2022 22:02 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard/67587/1 "2022-09-11T22:02:37Z")

</div>

Hi all!

Actually i have been using a custom Telegram "menu" in a simple way. I mean, a command node, and some functions to work together.

An example in the following screen shot.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/4/e4c91df861a1c82680e3839c2bbd259d5e91aee8.png)

The code:

```auto
[
    {
        "id": "a006ca3c.bf57f8",
        "type": "function",
        "z": "31d2354e.c7d47a",
        "name": "confirmation message",
        "func": "var opts = {\n reply_markup: JSON.stringify({\n keyboard: [\n ['Bajar peliculas'],\n ['Iluminacion'],\n ['Resetear Sonoffs'],\n ['Versiones Sonoffs'],\n ['Listar dispositivos en red local'],\n ['Ip publica'],\n ['Control de VMs'],\n ['Salir'],\n ],\n 'resize_keyboard' : true, \n 'remove_keyboard' : true\n })\n};\n\nmsg.payload.content = 'Selecciona una opción:';\nmsg.payload.options = opts;\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 400,
        "y": 100,
        "wires": [
            [
                "3737123ab3432afb"
            ]
        ]
    },
    {
        "id": "b9a949ef.104a98",
        "type": "function",
        "z": "31d2354e.c7d47a",
        "name": "create response",
        "func": "if(msg.payload.content === 'Bajar peliculas')\n{\n msg.payload.content = '/torrents';\n return [msg, null]; \n}\nif(msg.payload.content === 'Iluminacion')\n{\n msg.payload.content = '/iluminacion';\n return [msg, null];\n}\nif(msg.payload.content === 'Resetear Sonoffs')\n{\n msg.payload.content = '/resetsonoff';\n return [msg, null];\n}\nif(msg.payload.content === 'Versiones Sonoffs')\n{\n msg.payload.content = 'Chequeando versiones Tasmota en los sonoffs...';\n return [msg, null];\n}\nif(msg.payload.content === 'Listar dispositivos en red local')\n{\n msg.payload.content = 'Listar dispositivos en red local';\n return [msg, null];\n}\nif(msg.payload.content === 'Ip publica')\n{\n msg.payload.content = 'Procesando ip publica...';\n return [msg, null];\n}\nif(msg.payload.content === 'Control de VMs')\n{\n msg.payload.content = '/vmhosts';\n return [msg, null];\n}\nif(msg.payload.content === 'Salir')\n{\n msg.payload.content = 'Adios!';\n return [msg, null];\n}",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 380,
        "y": 140,
        "wires": [
            [
                "b0de20d8.017bf",
                "6cf94e31.1f1bf"
            ]
        ]
    },
    {
        "id": "b0de20d8.017bf",
        "type": "delay",
        "z": "31d2354e.c7d47a",
        "name": "",
        "pauseType": "delay",
        "timeout": "1",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "outputs": 1,
        "x": 360,
        "y": 180,
        "wires": [
            [
                "e9f67f2c.ee1b9"
            ]
        ]
    },
    {
        "id": "e9f67f2c.ee1b9",
        "type": "switch",
        "z": "31d2354e.c7d47a",
        "name": "",
        "property": "payload.content",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "/torrents",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "Listar dispositivos en red local",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "Procesando ip publica...",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "/vmhosts",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "Chequeando versiones Tasmota en los sonoffs...",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "Adios!",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 6,
        "x": 350,
        "y": 260,
        "wires": [
            [],
            [
                "51de7222f6db2ec3"
            ],
            [
                "0a99c7f2e11239e4"
            ],
            [
                "ad18cef9d91611dc"
            ],
            [
                "dd4a98e61e40e2b9"
            ],
            [
                "e7e65dd3fcb43324"
            ]
        ]
    }
]

```

How can i improve this?.  
Is there any way to make a Menu with inline keyboard?.  
suggestions?.

Thanks a lot!.

Regards.

---

<div class="post-metadata">

**Author:** ![Marty1982](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marty1982/32/20162_2.png) [@Marty1982](https://discourse.nodered.org/u/Marty1982)\
**Post date:** [13 September 2022 14:38 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard/67587/2 "2022-09-13T14:38:58Z")

</div>

Anyone?.

Thanks!

---

<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:** [13 September 2022 14:55 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard/67587/3 "2022-09-13T14:55:02Z")

</div>

Have you looked at the two examples in the node-red examples library. Click import \> examples \> node-red-contrib-telegrambot.

---

<div class="post-metadata">

**Author:** ![Marty1982](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marty1982/32/20162_2.png) [@Marty1982](https://discourse.nodered.org/u/Marty1982)\
**Post date:** [13 September 2022 15:27 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard/67587/4 "2022-09-13T15:27:49Z")

</div>

Yes i did. The thing is that i cannot make ir work with a Telegram command, those two examples are without a telegram command, so the Telegram node reply is quite different from each other.

Regards!

---

<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:** [13 September 2022 15:35 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard/67587/5 "2022-09-13T15:35:38Z")

</div>

Then show the flow you can not get to work, as no one can help if you do not show any issues. I would of thought that you would just attach your command node to the example, where the inject is.  
Their differences are one is inline keyboard the other is keyboard.

---

<div class="post-metadata">

**Author:** ![Marty1982](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marty1982/32/20162_2.png) [@Marty1982](https://discourse.nodered.org/u/Marty1982)\
**Post date:** [13 September 2022 17:15 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard/67587/6 "2022-09-13T17:15:00Z")

</div>

I've shared the flow from the first post, but i can upload fully if you need it.

Regards!

---

<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:** [13 September 2022 18:36 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard/67587/7 "2022-09-13T18:36:55Z")

</div>

You shared 2 function nodes and a switch with a 1 second delay, I saw no telegram nodes.

The function shows you are using keyboard style, if you want inline keyboards use example 2 (inline keyboard)from library examples. With Callback query node you can create a response to the selection or update the inline keyboard.

---

<div class="post-metadata">

**Author:** ![Marty1982](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marty1982/32/20162_2.png) [@Marty1982](https://discourse.nodered.org/u/Marty1982)\
**Post date:** [13 September 2022 20:54 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard/67587/8 "2022-09-13T20:54:53Z")

</div>

Yeah ok. The problem with that comes out when you have to call a message from Telegram. For example, you have a /menu message and then several options, you select one and then continue the flow to do whatever you need. That chain is hard to work (i don't know how to do it).

Maybe a node example will be helpful.

Tks!

---

<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:** [13 September 2022 21:58 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard/67587/9 "2022-09-13T21:58:25Z")

</div>

It shows you in example 2, the message property `msg.payload.content` outputted from the callback node holds the value of the callback\_data selected, in th example 2 either "1" or "2". The following function or switch node you can be use that value to decide which option you selected.  
Here is that example with the command on front and a switch to select between options, so all I added was a command node and a switch node, I also remover the hard coded chatid etc from first function node, as the command node passes those values on.

```auto
[{"id":"aa2e75d.cbd4488","type":"telegram command","z":"b779de97.b1b46","name":"","command":"/menu","description":"","registercommand":false,"language":"","scope":"default","bot":"125415a2.b4e0e2","strict":false,"hasresponse":true,"useregex":false,"removeregexcommand":false,"outputs":2,"x":760,"y":1400,"wires":[["f97878f7.de1bf8"],[]]},{"id":"f97878f7.de1bf8","type":"function","z":"b779de97.b1b46","name":"build keyboard","func":"var opts = {\n reply_markup: JSON.stringify({\n \"inline_keyboard\": [[\n {\n \"text\": \"A1\",\n \"callback_data\": \"1\" \n }, \n {\n \"text\": \"A2\",\n \"callback_data\": \"2\" \n }]\n ]\n })\n};\n\nmsg.payload.content = \"Selection?\";\nmsg.payload.options = opts;\nmsg.payload.type = \"message\";\n\nreturn [msg];\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":990,"y":1400,"wires":[["f7c18f49.063c4","67925ff5.4c7c9"]]},{"id":"f7c18f49.063c4","type":"telegram sender","z":"b779de97.b1b46","name":"","bot":"125415a2.b4e0e2","haserroroutput":false,"outputs":1,"x":1260,"y":1400,"wires":[[]]},{"id":"67925ff5.4c7c9","type":"debug","z":"b779de97.b1b46","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1220,"y":1360,"wires":[]},{"id":"385615779f4b3364","type":"function","z":"b779de97.b1b46","name":"answerCallbackQuery","func":"var text = \"Win - You clicked \" + msg.payload.content;\nvar options = {\n // text : text, <-- you can set the text here or use msg.payload.content \n show_alert : true,\n cache_time : 10\n};\n\nmsg.payload.content = text;\nmsg.payload.options = options;\nmsg.payload.type = \"answerCallbackQuery\";\n\nreturn [msg];\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1200,"y":1460,"wires":[["f7c18f49.063c4"]]},{"id":"652dce9e.9bede","type":"function","z":"b779de97.b1b46","name":"answerCallbackQuery","func":"var text = \"Lose - You clicked \" + msg.payload.content;\nmsg.payload.content = text;\n\nmsg.payload.type = \"message\";\n\nreturn [msg];\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1200,"y":1500,"wires":[["f7c18f49.063c4"]]},{"id":"3b460e58.b701ba","type":"switch","z":"b779de97.b1b46","name":"","property":"payload.content","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"eq","v":"2","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":980,"y":1480,"wires":[["385615779f4b3364"],["652dce9e.9bede"]]},{"id":"981d4537.1ced18","type":"telegram event","z":"b779de97.b1b46","name":"","bot":"125415a2.b4e0e2","event":"callback_query","autoanswer":false,"x":770,"y":1482,"wires":[["3b460e58.b701ba"]]},{"id":"125415a2.b4e0e2","type":"telegram bot","botname":"mybot","usernames":"","chatids":"-1001361034082","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}]

```

The API with more info, all methods and types can be actioned using http request nodes to, using the rest API.

> **[Telegram Bot API](https://core.telegram.org/bots/api#inlinekeyboardmarkup)**
>
> The Bot API is an HTTP-based interface created for developers keen on building bots for Telegram.
> To learn how to create…

---

<div class="post-metadata">

**Author:** ![Marty1982](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marty1982/32/20162_2.png) [@Marty1982](https://discourse.nodered.org/u/Marty1982)\
**Post date:** [15 September 2022 12:58 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard/67587/10 "2022-09-15T12:58:20Z")

</div>

Ok, great approach there and i've tested that before so thanks a lot!.

But....what about to have a secondary menu?, for example, Seleccion A, then Selection Ab, then Selection Ac and so on. That's the part i've been fooling around...

The main idea is to have multiple menu selections.

Thanks a lot!

---

<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:** [15 September 2022 15:41 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard/67587/11 "2022-09-15T15:41:16Z")

</div>

I have implemented something similar in my home-automation system.  
Here's part of the UI - to turn lights On/Off using two-level in-line keyboard.  
 ![telegram_AA](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/9/2987cbd9b46c1f779b7bbd804faba2d48bce8883.png)  
 ![telegram_B](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/0/e00095bdf85743efbe8d6b7fea1233ff6369c47a.png)

 ![telegram_C](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/c/7ce172547cccfbe632aacb38776628d5cf4dee4b.png)  
Here's the Javascript in the 'Turn lights' function block.

```auto

// Set the required access for this function here
var checklevel = 6;
var opts = {};

// Handle the help request
if (msg.originalMessage.help) {
    // only add the help command if the user has access to execute it
    if (msg.originalMessage.from.accesslevel >= checklevel) {
        msg.payload.content = msg.payload.content + "\r\n\r\nturn:\r\nSwitch lights on and off";  
    }
    return [null,null,msg];
}

// Check if this is a keyboard message
if (context.get("keyboard_turn")) {
    
    // Is this is a second keyboard request for the On/Off state ??
    if ((msg.payload.content==="On")||(msg.payload.content==="Off")) {
        context.set("keyboard_turn",false);
        msg.originalMessage.thing = context.get("thing");
        if (msg.payload.content==="On") {
            msg.originalMessage.state = "1";
        }
        if (msg.payload.content==="Off") {
            msg.originalMessage.state = "0";
        }
        msg.payload.content = "Turning light "+ msg.payload.content.toLowerCase();
    } else {
    
        // The response was NOT on or off, so this is only the first keyboard return
        
        // Parse the lights
        switch (msg.payload.content) {
            case "Home security Telegram reports":
                context.set("thing","telegram");
                break;
            case "IKEA light":
                context.set("thing","ikea");
                break;
            case "Herb Garden":
                context.set("thing","herb");
                break;
            case "House Front":
                context.set("thing","house");
                break;
            case "Print Server":
                context.set("thing","printer");
                break;
            default:
                // Not a recognized lamp type
                msg.payload.content="This option is not allowed";
                context.set("keyboard_turn",false);
                context.set("thing","");
        }
        if (context.get("thing")!=="") {
            opts = {
                reply_to_message_id: msg.payload.messageId,
                reply_markup: JSON.stringify({
                    keyboard: [
                        ['On'],
                        ['Off']],
                        'resize_keyboard': true,
                        'one_time_keyboard': true
                })
            };
            msg.payload.options = opts; 
            msg.payload.content = "Select the new state:";
        }
    }
    return [msg,null,null];  
}

// Check if the current message contains this function
if (msg.originalMessage.command==="switch") {
    // check if the user has access to execute this function
    if (msg.originalMessage.from.accesslevel >= checklevel) {
        if (msg.originalMessage.state===undefined) {
            // The state could not be detected, showing options
            opts = {
                reply_to_message_id: msg.payload.messageId,
                reply_markup: JSON.stringify({
                    keyboard: [
                        ['Home security Telegram reports'],
                        ['IKEA light'],
                        ['Herb Garden'],
                        ['House Front'],
                        ['Print Server']],
                        'resize_keyboard': true,
                        'one_time_keyboard': true
                })
            };
            msg.payload.content = "Select a light:";
            msg.payload.options = opts;  
            context.set("keyboard_turn",true);
        } else {
            msg.payload.content = "Turning "+msg.originalMessage.thing +" (light) "+msg.originalMessage.state;
        }
        return [msg,null,null];  
    } else {
        return [null,msg,null];
    }
} else {
    // pass the message to the next node
    return [null,null,msg];
}

```

The above piece of JavaScript was originally taken from Csongor Varga's Youtube video about Telegram - Chat Integration and then heavily modified to match my home situation.

[![](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/f/bf8289dacfaca74d114946424913dd5c3ba6203f.jpeg "Node-Red chat integration: Telegram bot") ](https://www.youtube.com/watch?v=wR1zWroRtCg)

---

<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:** [15 September 2022 17:21 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard/67587/12 "2022-09-15T17:21:19Z")

</div>

Then create a secondary menu after the callback node and send it to sender node, or if you want the different commands to create different menus, pass though switch after the command node and create the menu for each command, or do it in the function.

---

<div class="post-metadata">

**Author:** ![Marty1982](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marty1982/32/20162_2.png) [@Marty1982](https://discourse.nodered.org/u/Marty1982)\
**Post date:** [15 September 2022 18:41 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard/67587/13 "2022-09-15T18:41:48Z")

</div>

Thanks a lot I got it working with some tweaks.

Regards!

---

<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:** [15 September 2022 18:45 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard/67587/14 "2022-09-15T18:45:31Z")

</div>

Would you care to publish your flow, so other people can see a possible solution?

---

<div class="post-metadata">

**Author:** ![Marty1982](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marty1982/32/20162_2.png) [@Marty1982](https://discourse.nodered.org/u/Marty1982)\
**Post date:** [15 September 2022 19:05 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard/67587/15 "2022-09-15T19:05:13Z")

</div>

Oh yes! Of course, my bad.

This is a basic example with a menu and a sub menu.

```auto
[
    {
        "id": "146caad9ed676760",
        "type": "telegram command",
        "z": "59dc13f283450f9c",
        "name": "",
        "command": "/menu",
        "description": "",
        "registercommand": false,
        "language": "",
        "scope": "default",
        "bot": "",
        "strict": false,
        "hasresponse": true,
        "useregex": false,
        "removeregexcommand": false,
        "outputs": 2,
        "x": 90,
        "y": 120,
        "wires": [
            [
                "aa6745504cf68296"
            ],
            []
        ]
    },
    {
        "id": "aa6745504cf68296",
        "type": "function",
        "z": "59dc13f283450f9c",
        "name": "build keyboard",
        "func": "var opts = {\n reply_markup: JSON.stringify({\n \"inline_keyboard\": [[\n {\n \"text\": \"option\",\n \"callback_data\": \"option\" \n }\n]\n ]\n })\n};\n\nmsg.payload.content = \"Elija una opción: \";\nmsg.payload.options = opts;\nmsg.payload.type = \"message\";\n\nreturn [msg];\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 400,
        "y": 120,
        "wires": [
            [
                "18638dee03ff7b2e"
            ]
        ]
    },
    {
        "id": "18638dee03ff7b2e",
        "type": "telegram sender",
        "z": "59dc13f283450f9c",
        "name": "",
        "bot": "",
        "haserroroutput": false,
        "outputs": 1,
        "x": 990,
        "y": 220,
        "wires": [
            []
        ]
    },
    {
        "id": "648a46aa05186572",
        "type": "switch",
        "z": "59dc13f283450f9c",
        "name": "menu options from \"build keyboard call_data\"",
        "property": "payload.content",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "option",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 490,
        "y": 200,
        "wires": [
            [
                "d9ebd8cef2fe7354"
            ]
        ]
    },
    {
        "id": "e3d1473eefad76bf",
        "type": "telegram event",
        "z": "59dc13f283450f9c",
        "name": "callback menu principal",
        "bot": "",
        "event": "callback_query",
        "autoanswer": false,
        "x": 140,
        "y": 200,
        "wires": [
            [
                "648a46aa05186572"
            ]
        ]
    },
    {
        "id": "d9ebd8cef2fe7354",
        "type": "function",
        "z": "59dc13f283450f9c",
        "name": "menu options",
        "func": "var opts = {\n reply_markup: JSON.stringify({\n \"inline_keyboard\": [[\n {\n \"text\": \"sub option\",\n \"callback_data\": \"sub option\" \n }]\n ]\n })\n};\n\nmsg.payload.content = \"Elija una opción: \";\nmsg.payload.options = opts;\nmsg.payload.type = \"message\";\n\nreturn [msg];\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 400,
        "y": 240,
        "wires": [
            [
                "18638dee03ff7b2e"
            ]
        ]
    },
    {
        "id": "2734baede7850e6c",
        "type": "telegram event",
        "z": "59dc13f283450f9c",
        "name": "callback",
        "bot": "",
        "event": "callback_query",
        "autoanswer": false,
        "x": 100,
        "y": 320,
        "wires": [
            [
                "bf9b0dc95dd68e8e"
            ]
        ]
    },
    {
        "id": "bf9b0dc95dd68e8e",
        "type": "switch",
        "z": "59dc13f283450f9c",
        "name": "sub option",
        "property": "payload.content",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "sub option",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 390,
        "y": 320,
        "wires": [
            []
        ]
    }
]

```

---

<div class="post-metadata">

**Author:** ![Marty1982](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marty1982/32/20162_2.png) [@Marty1982](https://discourse.nodered.org/u/Marty1982)\
**Post date:** [15 September 2022 19:38 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard/67587/16 "2022-09-15T19:38:57Z")

</div>

One last question.

is it possible to auto adjust the buttons that Telegram shows?. In my mobile phone they show a liitle tight.

Regards!

---

<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:** [15 September 2022 20:05 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard/67587/17 "2022-09-15T20:05:40Z")

</div>

The arrays in side initial array are rows, so.  
[[{},{}]] is one row of two buttons  
So it think, not tested  
[[{},{}],[{},{}]]  
Would be two rows of two buttons.  
Not 100% sure though.

---

<div class="post-metadata">

**Author:** ![Marty1982](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marty1982/32/20162_2.png) [@Marty1982](https://discourse.nodered.org/u/Marty1982)\
**Post date:** [16 September 2022 02:02 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard/67587/18 "2022-09-16T02:02:14Z")

</div>

mmm that doesn't work i think. Maybe you have an example?.

---

<div class="post-metadata">

**Author:** ![Marty1982](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marty1982/32/20162_2.png) [@Marty1982](https://discourse.nodered.org/u/Marty1982)\
**Post date:** [19 September 2022 02:44 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard/67587/19 "2022-09-19T02:44:20Z")

</div>

In fact, i've broken the Json file, luckly i had a backup.

Regards!

---

<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:** [3 October 2022 02:45 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard/67587/20 "2022-10-03T02:45:19Z")

</div>

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