Telegrambot not working

I have exact the same problem as described here 4 years ago: https://discourse.nodered.org/t/telegram-not-working/5810
I have spent a lot time to find a reason why its not working, but without any success:
On my first installation, running Node Red v1.2.9 the node-red-contrib-telegrambot is working fine as expected.
On my new System (Intel NUC + Debian) I installed Node Red using the script for Raspberry Pi. Node Red is running as a service and the only software running on that system.
If I try sending a message there is happening absolute nothing, even no message on both outputs of the sender node.
I would be really happy if someone has an idea!

Harald

Node-RED v1.2.9 is an old version, it is up to V3.0 now (V2.2.2 was the last version). Did you use the script on this page to load Node-RED, it is for any system running a Debian based OS.

I can confirm that node-red-contrib-telegrambot v12.0.0 is working fine.

Have you checked the messages going into the TelegramBot node with a Debug node to see if they conform the the format required by the Node itself?

Can you send the messages that are displayed in the terminal as Node-RED starts up? Are there any errors? (Issue node-red-stop, then node-red-start from a terminal and show the messages)

Are you trying to run both systems together? In which case you need to change the bot ID of one of them.

Im using different bot ID's on both systems.

Yes, I use this script for installation and upgrade.
node-red-contrib-telegrambot v12.0.0 is working fine on my Node Red 1.2.9 system.

Yes, this are exactly the same messages that are working on my other installation so they are definitely correct. I more than once checked this...

Start Node-RED
 
Once Node-RED has started, point a browser at http://192.168.0.225:1880
On Pi Node-RED works better with the Firefox or Chrome browser
 
Use   sudo systemctl enable nodered.service  to autostart Node-RED at every boot
Use   sudo systemctl disable nodered.service to disable autostart on boot
 
To find more nodes and example flows - go to http://flows.nodered.org
 
Starting as root systemd service.
20 Jul 18:18:45 - [info]
Willkommen bei Node-RED!
===================
20 Jul 18:18:45 - [info] Node-RED Version: v3.0.0
20 Jul 18:18:45 - [info] Node.js  Version: v14.20.0
20 Jul 18:18:45 - [info] Linux 5.10.0-14-amd64 x64 LE
20 Jul 18:18:45 - [info] Paletten-Nodes werden geladen
20 Jul 18:18:47 - [info] node-red-contrib-ccu version: 3.4.2
20 Jul 18:18:47 - [info] Dashboard version 3.1.7 started at /ui
20 Jul 18:18:47 - [info] Einstellungsdatei: /root/.node-red/settings.js
20 Jul 18:18:47 - [info] Kontextspeicher: memoryOnly [module=memory]
20 Jul 18:18:47 - [info] Kontextspeicher: file [module=localfilesystem]
20 Jul 18:18:47 - [info] Benutzerverzeichnis: /root/.node-red
20 Jul 18:18:47 - [warn] Projekte deaktiviert: editorTheme.projects.enabled=false
20 Jul 18:18:47 - [info] Flow-Datei: /root/.node-red/flows.json
20 Jul 18:18:47 - [info] Server wird jetzt auf http://127.0.0.1:1880/ ausgefĂĽhrt
20 Jul 18:18:47 - [warn] Using unencrypted credentials
20 Jul 18:18:47 - [info] Flows werden gestartet
20 Jul 18:18:48 - [info] [ccu-connection:CCU3 (192.168.0.222)] paramsets loaded from /root/.node-red/paramsets.json
20 Jul 18:18:48 - [info] [ccu-connection:CCU3 (192.168.0.222)] metadata loaded from /root/.node-red/ccu_192.168.0.222.json
20 Jul 18:18:48 - [info] [ccu-connection:CCU3 (192.168.0.222)] regadata loaded from /root/.node-red/ccu_rega_192.168.0.222.json
20 Jul 18:18:48 - [info] [ccu-connection:CCU3 (192.168.0.222)] values loaded from /root/.node-red/ccu_values_192.168.0.222.json
20 Jul 18:18:48 - [info] [hue-bridge:Philips hue] Initializing the bridge (192.168.0.109)…
20 Jul 18:18:48 - [info] [ccu-connection:192.168.181.222] paramsets loaded from /root/.node-red/paramsets.json
20 Jul 18:18:48 - [info] [ccu-connection:192.168.181.222] metadata loaded from /root/.node-red/ccu_192.168.181.222.json
20 Jul 18:18:48 - [info] [ccu-connection:192.168.181.222] regadata loaded from /root/.node-red/ccu_rega_192.168.181.222.json
20 Jul 18:18:48 - [info] [ccu-connection:192.168.181.222] values loaded from /root/.node-red/ccu_values_192.168.181.222.json
20 Jul 18:18:48 - [info] [ccu-connection:192.168.178.222] paramsets loaded from /root/.node-red/paramsets.json
20 Jul 18:18:48 - [info] [ccu-connection:192.168.178.222] metadata loaded from /root/.node-red/ccu_192.168.178.222.json
20 Jul 18:18:48 - [info] [ccu-connection:192.168.178.222] regadata loaded from /root/.node-red/ccu_rega_192.168.178.222.json
20 Jul 18:18:48 - [info] [ccu-connection:192.168.178.222] values loaded from /root/.node-red/ccu_values_192.168.178.222.json
20 Jul 18:18:48 - [info] [alexa-smart-home-v3-conf] Node-RED contrib version: v0.4.68
20 Jul 18:18:48 - [info] [alexa-smart-home-v3-conf] Connecting to Alexa/ Google Home Skill MQTT server: mq-red.cb-net.co.uk, account username: 
20 Jul 18:18:48 - [info] [udp in:SMA EM] UDP: Port 9522 bereits in Verwendung
20 Jul 18:18:48 - [info] Flows sind gestartet
20 Jul 18:18:48 - [info] [udp in:cffeb3b4.95dba] UDP-Multicast-Gruppe 239.12.255.254
20 Jul 18:18:48 - [info] [udp in:cffeb3b4.95dba] UDP-Empfangsbereitschaft bei 0.0.0.0:9522
20 Jul 18:18:48 - [info] [udp in:SMA EM] UDP-Empfangsbereitschaft bei 0.0.0.0:9522
20 Jul 18:18:48 - [info] [udp out:f60a15d9.81033] UDP-Broadcast bereit: -> 239.255.255.250:1900
20 Jul 18:18:48 - [info] [serialconfig:eb81b71a5e1d7cc0] Seriellen Port /dev/ttyUSB0 geöffnet mit 38400 Baud, 8N1
20 Jul 18:18:48 - [info] [sqlitedb:2c322b20c00e7c7b] opened /sqlite/messwerte ok
20 Jul 18:18:48 - [info] [alexa-smart-home-v3-conf:98f059a4.4dcb58] Successfully connected to Alexa/ Google Home Skill MQTT server: mq-red.cb-net.co.uk, account username:
20 Jul 18:18:48 - [info] [hue-bridge:Philips hue] Connected to bridge
20 Jul 18:18:48 - [info] [ccu-connection:CCU3 (192.168.0.222)] rega getValues
20 Jul 18:18:50 - [info] [ccu-connection:CCU3 (192.168.0.222)] values saved to /root/.node-red/ccu_values_192.168.0.222.json
20 Jul 18:18:50 - [info] [ccu-connection:CCU3 (192.168.0.222)] Interfaces: ReGaHSS, BidCos-RF, HmIP-RF, VirtualDevices
20 Jul 18:18:50 - [info] [ccu-connection:CCU3 (192.168.0.222)] Interface ReGaHSS connected
20 Jul 18:18:50 - [info] [ccu-connection:CCU3 (192.168.0.222)] init BidCos-RF http://192.168.0.225:2051 nr_PB80PW_BidCos-RF
20 Jul 18:18:50 - [info] [ccu-connection:CCU3 (192.168.0.222)] init HmIP-RF http://192.168.0.225:2051 nr_PB80PW_HmIP-RF
20 Jul 18:18:50 - [info] [ccu-connection:CCU3 (192.168.0.222)] init VirtualDevices http://192.168.0.225:2051 nr_PB80PW_VirtualDevices
20 Jul 18:18:50 - [info] [ccu-connection:CCU3 (192.168.0.222)] xmlrpc server listening on http://192.168.0.225:2051
20 Jul 18:18:50 - [info] [ccu-connection:CCU3 (192.168.0.222)] Interface VirtualDevices http port 49292 connected
20 Jul 18:18:50 - [info] [ccu-connection:CCU3 (192.168.0.222)] Interface BidCos-RF http port 42001 connected
20 Jul 18:18:50 - [info] [ccu-connection:CCU3 (192.168.0.222)] regadata saved to /root/.node-red/ccu_rega_192.168.0.222.json
20 Jul 18:18:50 - [info] [ccu-connection:CCU3 (192.168.0.222)] Interface HmIP-RF http port 42010 connected
20 Jul 18:18:50 - [info] [hue-bridge:Philips hue] Processing bridge resources…
20 Jul 18:18:50 - [info] [hue-bridge:Philips hue] Initial emit of resource states…
20 Jul 18:18:50 - [info] [ccu-connection:CCU3 (192.168.0.222)] metadata saved to /root/.node-red/ccu_192.168.0.222.json
20 Jul 18:18:50 - [info] [ccu-connection:192.168.178.222] rega getValues
20 Jul 18:18:50 - [info] [ccu-connection:192.168.178.222] values saved to /root/.node-red/ccu_values_192.168.178.222.json
20 Jul 18:18:50 - [info] [e-mail] Nachricht gesendet: 250 Requested mail action okay, completed: id=1MpDRv-1njEyD3Hhf-00qfiI
20 Jul 18:18:51 - [info] [e-mail] Nachricht gesendet: 250 Requested mail action okay, completed: id=1MjSHa-1nmF6W3ZoQ-00kuSO
20 Jul 18:18:51 - [info] [ccu-connection:192.168.178.222] Interfaces: ReGaHSS, BidCos-RF, HmIP-RF, VirtualDevices
20 Jul 18:18:51 - [info] [ccu-connection:192.168.178.222] Interface ReGaHSS connected
20 Jul 18:18:51 - [info] [ccu-connection:192.168.178.222] init BidCos-RF http://192.168.0.225:2071 nr_4KluFE_BidCos-RF
20 Jul 18:18:51 - [info] [ccu-connection:192.168.178.222] init HmIP-RF http://192.168.0.225:2071 nr_4KluFE_HmIP-RF
20 Jul 18:18:51 - [info] [ccu-connection:192.168.178.222] init VirtualDevices http://192.168.0.225:2071 nr_4KluFE_VirtualDevices
20 Jul 18:18:51 - [info] [ccu-connection:192.168.178.222] xmlrpc server listening on http://192.168.0.225:2071

It looks to me like all is loading OK. But then there are those that know far more than me, hopefully someone can step in.

Only thing I can suggest is a bad download of either Node-RED or Telegrambot. Maybe a re-install of Telegram bot and if that doesn't work, reinstall Node-RED. That would be my next steps, but to be truthful, I am at a loss now.

next step would be to increase the nr logging level to see what the telegram node is actually doing (or not).

I already have deinstalled node-red-contrib-telegrambot, then installed and tested node-red-contrib-telegrambot-home with the same result, then deinstalled this and installed node-red-contrib-telegrambot again.
I also upgraded Node Red from 2.2.2 to 3.0.0 and nothing changed.

I have changed the log level to "trace" but there is absolutely no entry regarding the telegrambot.

First thing I would do is to make a backup of your flow. Then I would add a debug node to the node feeding the telegrambot node and capture that data.
Next I would remove everything but an inject node the telegrambot node a debug node and put the captured data in the inject node.

Also add a flow of the catch node connected to a debug node.

This way you can send the msg to the telegrambot node and see if any thing else is creating the issue.

1 Like

What do you mean by that?

The flow I'm using for testing now looks as follows:

[{"id":"81eeedb9ca739de9","type":"telegram sender","z":"2ee5b5dc.d3b792","name":"","bot":"c1d85a8f3619940c","haserroroutput":true,"outputs":2,"x":400,"y":1120,"wires":[["1c2de620d7b4be26"],["1c2de620d7b4be26"]]},{"id":"133ef30eabe7b34c","type":"inject","z":"2ee5b5dc.d3b792","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"content\":\"Testnachricht\",\"chatId\":123456789,\"type\":\"message\"}","payloadType":"json","x":370,"y":1060,"wires":[["8b6a0143d472ba0e","81eeedb9ca739de9"]]},{"id":"1c2de620d7b4be26","type":"debug","z":"2ee5b5dc.d3b792","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":620,"y":1120,"wires":[]},{"id":"e8afbf605c42a3be","type":"catch","z":"2ee5b5dc.d3b792","name":"","scope":null,"uncaught":false,"x":380,"y":1180,"wires":[["85716bcf2f57373e"]]},{"id":"85716bcf2f57373e","type":"debug","z":"2ee5b5dc.d3b792","name":"debug 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":620,"y":1180,"wires":[]},{"id":"8b6a0143d472ba0e","type":"debug","z":"2ee5b5dc.d3b792","name":"debug 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":620,"y":1060,"wires":[]},{"id":"c1d85a8f3619940c","type":"telegram bot","botname":"Status","usernames":"","chatids":"","baseapiurl":"","updatemode":"none","pollinterval":"300","usesocks":false,"sockshost":"","socksport":"6667","socksusername":"anonymous","sockspassword":"","bothost":"","botpath":"","localbotport":"8443","publicbotport":"8443","privatekey":"","certificate":"","useselfsignedcertificate":false,"sslterminated":false,"verboselogging":false}]

There is only an output from debug 3 with the message going into the telegram sender node.
The telegram sender node always shows "connected" regardless if the Token is correct or not.

I get the same error with my Telegrambot after copying your flow. My functions still run OK to the same Bot. Changed JSONata ChatID - OK.

Might there be an error in your JSONata? Is the chatID in JSONata correct?

The ChatID and the Token I'm using are definitely correct.

I have tried the same flow on my old system and the output is as it should be (I have changed the ChatId to 123456789 before pasting here):

21.7.2022, 12:03:04node: debug 3
msg : Object
object
_msgid: "d0fc0638.59b4c8"
payload: object
content: "Testnachricht"
chatId: 123456789
type: "message"
topic: ""
21.7.2022, 12:03:04node: debug 1
msg : Object
object
_msgid: "d0fc0638.59b4c8"
payload: object
content: object
chatId: 123456789
type: "message"
options: object
sentMessageId: 10835
topic: ""

On my new system the same flow produces the following output:

21.7.2022, 11:57:12node: debug 3
msg : Object
object
_msgid: "c57f124a1301f97e"
payload: object
content: "Testnachricht"
chatId: 123456789
type: "message"
topic: ""

Also I get an error message on my old system if I change the ChatId or the Token to a wrong value. On the new system if I do the same there is no error message at all.

So it looks like the telegram sender node is doing absolutely nothing on my new system.

When redeploying I sometimes get the following error message from the telegram node:

21.7.2022, 12:25:44node: c1d85a8f3619940c
msg : string[46]
"Fehler beim Stoppen des Nodes: Close timed out"

Which node is that? click the id to reveal which node it is.

PS: top-tip - give your nodes sensible names (it helps you and those trying to help you) :slight_smile:


I have not read all of this thread but it seems like an isolated issue with one node-red installation (not an issue with telegrambot as the topic suggests).

I think i read you have 2 bots, and the other one works on another node-red? What happens if you try using the other (known working) bots details in the problematic node-red installation? (obviously you would disable the other bot while testing its token etc on another node-red)

In the log I find in that case the following error message:

21 Jul 12:55:19 - [error] [telegram bot:c1d85a8f3619940c] Fehler beim Stoppen des Nodes: Close timed out

It is the "telegram bot" node which holds the Token.

I have tried this but with no success.

I agree that there seems to be something wrong with the complete installation which prevents the telegram bot from working. The question is how to find out what it is because the system had been relatively fresh installed (not years ago...) and it is running only Debian and Node Red and nothing else.