# Telegram Inline keyboard without Command node

**URL:** <https://discourse.nodered.org/t/telegram-inline-keyboard-without-command-node/13275>\
**Category:** General\
**Created:** [14 July 2019 18:59 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard-without-command-node/13275 "2019-07-14T18:59:04Z")\
**Posts on this page:** 15\
**Page:** 2

<div class="post-metadata">

**Author:** ![greengolfer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/greengolfer/32/28276_2.png) [@greengolfer](https://discourse.nodered.org/u/greengolfer)\
**Post date:** [15 July 2019 12:24 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard-without-command-node/13275/21 "2019-07-15T12:24:38Z")

</div>

> [@bakman2](#):
>
> This is the flow (i had to desanitize it).  
> Make sure to enter the chatid in the command-node and payload-node.
> 
> ```auto
> [{"id":"4d52e6db.884308","type":"telegrambot-command","z":"30358c58.b1f39c","name":"","bot":"7f0ce88d.8f81e","command":"door_event","commandType":"str","commandCase":false,"x":150,"y":725,"wires":[["ff98728c.b9243"]]},{"id":"54c6182b.d8a728","type":"telegrambot-payload","z":"30358c58.b1f39c","name":"","bot":"7f0ce88d.8f81e","chatId":"","sendMethod":"","payload":"","x":515,"y":725,"wires":[["32b7ce43.71e73a"]]},{"id":"ff98728c.b9243","type":"function","z":"30358c58.b1f39c","name":"","func":"out = {\n method: \"sendMessage\",\n payload: {\n text: \"Open door ?\",\n reply_markup: {\n inline_keyboard: [\n [{\n text: \"Yes\",\n url: \"http://google.com\"\n }],\n [{\n text: \"No\",\n url: \"http://google.com\"\n }]\n ]\n }\n }\n}\nreturn out;","outputs":1,"noerr":0,"x":325,"y":725,"wires":[["54c6182b.d8a728"]]},{"id":"32b7ce43.71e73a","type":"debug","z":"30358c58.b1f39c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":750,"y":725,"wires":[]},{"id":"7f0ce88d.8f81e","type":"telegrambot-config","z":0,"botname":"","usernames":"","chatIds":"","pollInterval":"1000"}]
> 
> ```
> 
> Now if you receive a message "door\_event", you will get the buttons and as an example url it will take you to google, ofcourse you need to change this to the action you want.

Thanks! I'll try that.  
I was using [node-red-contrib-telegrambot (node) - Node-RED](https://flows.nodered.org/node/node-red-contrib-telegrambot) when yours is base on the [node-red-contrib-telegrambot-home (node) - Node-RED](https://flows.nodered.org/node/node-red-contrib-telegrambot-home) !!  
I will check if with this other one, I have more success. Stay tuned 🙂

GV

---

<div class="post-metadata">

**Author:** ![greengolfer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/greengolfer/32/28276_2.png) [@greengolfer](https://discourse.nodered.org/u/greengolfer)\
**Post date:** [15 July 2019 12:45 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard-without-command-node/13275/22 "2019-07-15T12:45:04Z")

</div>

> [@bakman2](#):
>
> This is the flow (i had to desanitize it).  
> Make sure to enter the chatid in the command-node and payload-node.
> 
> ```auto
> [{"id":"4d52e6db.884308","type":"telegrambot-command","z":"30358c58.b1f39c","name":"","bot":"7f0ce88d.8f81e","command":"door_event","commandType":"str","commandCase":false,"x":150,"y":725,"wires":[["ff98728c.b9243"]]},{"id":"54c6182b.d8a728","type":"telegrambot-payload","z":"30358c58.b1f39c","name":"","bot":"7f0ce88d.8f81e","chatId":"","sendMethod":"","payload":"","x":515,"y":725,"wires":[["32b7ce43.71e73a"]]},{"id":"ff98728c.b9243","type":"function","z":"30358c58.b1f39c","name":"","func":"out = {\n method: \"sendMessage\",\n payload: {\n text: \"Open door ?\",\n reply_markup: {\n inline_keyboard: [\n [{\n text: \"Yes\",\n url: \"http://google.com\"\n }],\n [{\n text: \"No\",\n url: \"http://google.com\"\n }]\n ]\n }\n }\n}\nreturn out;","outputs":1,"noerr":0,"x":325,"y":725,"wires":[["54c6182b.d8a728"]]},{"id":"32b7ce43.71e73a","type":"debug","z":"30358c58.b1f39c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":750,"y":725,"wires":[]},{"id":"7f0ce88d.8f81e","type":"telegrambot-config","z":0,"botname":"","usernames":"","chatIds":"","pollInterval":"1000"}]
> 
> ```
> 
> Now if you receive a message "door\_event", you will get the buttons and as an example url it will take you to google, ofcourse you need to change this to the action you want.

I must be dumb... but it still doesn't work.  
I just created another flow:

```auto
[{"id":"c249796b.749418","type":"telegrambot-payload","z":"a18eeace.049638","name":"","bot":"53ccb726.9fe938","chatId":"12345678","sendMethod":"sendMessage","payload":"{\n \"text\": \"door_event\"\n}","x":570,"y":220,"wires":[[]]},{"id":"c25e5e27.0e419","type":"inject","z":"a18eeace.049638","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":320,"y":220,"wires":[["c249796b.749418"]]},{"id":"53ccb726.9fe938","type":"telegrambot-config","z":0,"botname":"","usernames":"","chatIds":"","pollInterval":"1000"}]

```

So, I am sending the door\_event string and nothing happens after the door\_event message is received on telegram. ☹

GV

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [15 July 2019 13:07 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard-without-command-node/13275/23 "2019-07-15T13:07:03Z")

</div>

I provided the code, the instructions and a screenshot. It works.

You created another flow with an arbitrary "chatid", i hope you are using the [chatid](https://stackoverflow.com/questions/32423837/telegram-bot-how-to-get-a-group-chat-id) that belongs to your bot, else it will not work.

---

<div class="post-metadata">

**Author:** ![greengolfer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/greengolfer/32/28276_2.png) [@greengolfer](https://discourse.nodered.org/u/greengolfer)\
**Post date:** [16 July 2019 06:30 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard-without-command-node/13275/24 "2019-07-16T06:30:47Z")

</div>

As I said I must miss something.

1. In the telegram command node there is no place to enter a chat\_id. The allowed chat\_ids are listed in the configuration node. There is only the matching string to configure in that node.
2. The other flow is to be able to easily send the "doot\_event" text message. The chat\_id is consistent with my bot.  
I receive the message in telegram but this message doesn't trigger the command node.

In the example you provided, the flow sending the door\_event was not there. I added one to check without luck.

Yesterday evening, I looked at another way to do it. I tried the same thing with the redbot [https://flows.nodered.org/node/node-red-contrib-chatbot](https://flows.nodered.org/node/node-red-contrib-chatbot)

and here, miracle. It works. You even have a "Buttons" node making the inline\_keyboard so easy to do.  
🙂

Thanks for your help!!

GV

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [16 July 2019 06:40 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard-without-command-node/13275/25 "2019-07-16T06:40:13Z")

</div>

> [@greengolfer](#):
>
> The allowed chat\_ids are listed in the configuration node.

That's where you had to put it.

As long as it works for you, it is great.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [16 July 2019 11:16 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard-without-command-node/13275/26 "2019-07-16T11:16:17Z")

</div>

> [@greengolfer](#):
>
> redbot

Looks like that node has come on quite a bit since I last tried it. I've had a couple of attempts with it in the past and each time gave up due to complexity and lack of documentation. Hopefully all that is fixed now.

Nice to see support for Rivescript 2 and telegram webhooks. Still a bit annoying to have dozens of nodes in your palette.

I think I need to try it again.

---

<div class="post-metadata">

**Author:** ![Bobo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bobo/32/8401_2.png) [@Bobo](https://discourse.nodered.org/u/Bobo)\
**Post date:** [17 July 2019 02:36 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard-without-command-node/13275/27 "2019-07-17T02:36:16Z")

</div>

> [@TotallyInformation](#):
>
> I think I need to try it again.

Please keep us posted. The number of nodes was also what put me off trying it.

---

<div class="post-metadata">

**Author:** ![greengolfer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/greengolfer/32/28276_2.png) [@greengolfer](https://discourse.nodered.org/u/greengolfer)\
**Post date:** [17 July 2019 06:26 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard-without-command-node/13275/28 "2019-07-17T06:26:13Z")

</div>

Compare to the other telegram-bot flavours you are flooded by many nodes. And yes, the documentation is strange. A lot of wiki pages but no really detail on how to use it.  
Using a few screenshot found here and there, you eventually manage to assemble nodes. It is quite powerful and 0 javascript to write to get the eg the keyboard.

GV

---

<div class="post-metadata">

**Author:** ![Bobo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bobo/32/8401_2.png) [@Bobo](https://discourse.nodered.org/u/Bobo)\
**Post date:** [17 July 2019 06:39 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard-without-command-node/13275/29 "2019-07-17T06:39:00Z")

</div>

> [@greengolfer](#):
>
> 0 javascript to write to get the eg the keyboard.

That bit does sound tempting. I have implemented all the "core" functionality (input, output, images etc) re Telegram/NR except the keyboards. Mmm.

---

<div class="post-metadata">

**Author:** ![greengolfer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/greengolfer/32/28276_2.png) [@greengolfer](https://discourse.nodered.org/u/greengolfer)\
**Post date:** [17 July 2019 10:39 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard-without-command-node/13275/30 "2019-07-17T10:39:17Z")

</div>

Hello,  
Here is the all flow. Event for the door bell, take picture, send it, send Yes/No button. Game over!

 ![24](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/5/5b775da7263d86f22a4e8b1e163e917d3781387b.png)

---

<div class="post-metadata">

**Author:** ![Hunter](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hunter/32/60045_2.png) [@Hunter](https://discourse.nodered.org/u/Hunter)\
**Post date:** [24 May 2020 16:42 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard-without-command-node/13275/31 "2020-05-24T16:42:21Z")

</div>

Hallo allemaal,

I'm trying to figure out how to listen to the button callback. I managed to set up 4 buttons but next step will be to handle the data when clicking one of them.

Can anyone help me on this?

---

<div class="post-metadata">

**Author:** ![greengolfer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/greengolfer/32/28276_2.png) [@greengolfer](https://discourse.nodered.org/u/greengolfer)\
**Post date:** [24 May 2020 18:44 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard-without-command-node/13275/32 "2020-05-24T18:44:25Z")

</div>

> [@Hunter](#):
>
> Can anyone help me on this?

Here is an example with the telegram received node:

```auto
[{"id":"56f5732a.36cd0c","type":"chatbot-telegram-receive","z":"4b860295.c5a50c","bot":"24a3f1a2.06f69e","botProduction":"f6f1fe57.409e5","x":215,"y":2800,"wires":[["5da7161.f2852e8"]],"l":false},{"id":"5da7161.f2852e8","type":"switch","z":"4b860295.c5a50c","name":"Message","property":"payload.content","propertyType":"msg","rules":[{"t":"eq","v":"light","vt":"str"},{"t":"eq","v":"door","vt":"str"},{"t":"regex","v":"music.*","vt":"str","case":false},{"t":"eq","v":"heat","vt":"str"},{"t":"eq","v":"alarm","vt":"str"},{"t":"regex","v":"velux.*","vt":"str","case":false},{"t":"regex","v":"[0-9][0-9][0-9][0-9][0-9][0-9]","vt":"str","case":false}],"checkall":"true","repair":false,"outputs":7,"x":320,"y":2800,"wires":[[],[],[],[],[],[],[]]},{"id":"24a3f1a2.06f69e","type":"chatbot-telegram-node","z":"","botname":"@MyChatDev","usernames":"","providerToken":"","polling":"1000","store":"","log":"","parseMode":"","debug":false,"webHook":"","connectMode":"polling"},{"id":"f6f1fe57.409e5","type":"chatbot-telegram-node","z":"","botname":"@MyChatProd","usernames":"","providerToken":"","polling":"1000","store":"","log":"","parseMode":"","debug":false,"webHook":"","connectMode":"polling"}]

```

Which is:

 ![Screenshot.05-24-2020-20.43.25](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/7/27beb024d0933c664bee773cf24deafd9674e567.png)

And then out of the switch node, you do what you want based on the answer.

GV

---

<div class="post-metadata">

**Author:** ![Hunter](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hunter/32/60045_2.png) [@Hunter](https://discourse.nodered.org/u/Hunter)\
**Post date:** [24 May 2020 19:01 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard-without-command-node/13275/33 "2020-05-24T19:01:03Z")

</div>

Hello greengolfer,

Thanks for the reply, I imported your flow but it seems you are using a different chatbot? I'm using node-red-contrib-telegrambot which is also mentioned in the start post of this thread. The documentation tells me node-red-contrib-telegrambot should be able to handle callbacks, but I'm looking for an example 🙂

---

<div class="post-metadata">

**Author:** ![Hunter](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hunter/32/60045_2.png) [@Hunter](https://discourse.nodered.org/u/Hunter)\
**Post date:** [24 May 2020 21:19 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard-without-command-node/13275/34 "2020-05-24T21:19:37Z")

</div>

Never mind, I figured it out. The manual showed a callback\_query node, but couldn't find it on the palette. In the end it seemed that when I drag an event node to the flow, the name changes to callback\_query. Using a debug node to monitor the output it was a piece of cake to get it going. 🙂

---

<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:** [7 June 2020 21:19 UTC](https://discourse.nodered.org/t/telegram-inline-keyboard-without-command-node/13275/35 "2020-06-07T21:19:45Z")

</div>

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

[Previous page](https://discourse.nodered.org/t/telegram-inline-keyboard-without-command-node/13275.md?page=1)
