Telegram not working



I am currently using node-red-contrib-telegrambot ( but the issue remains on other similar Telegram nodes as well.

I am able to send a message using a http get-node, so I know I have the correct token. When I try sending a message with the Telegram Sender-node, nothing happens (it does not even output an error to a debug node).

But I get two errors everytime it polls:

Unknown error. Trying again.
"EFATAL: Error: connect ENOENT /(MY_TOKEN)/getUpdates"

When I type node -v in terminal it says v8.11.1 and when I type nodejs -v it says v8.14.0.

Node-red is version v0.19.5.

I am running Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-42-generic x86_64).

The Telegram Send node gets the following msg object (injected with a timestamp as payload):

msg.payload = { chatId: (MY_CHAT_ID), type: 'message', content: msg.payload }

I also tried exporting the flow to my Node Red installation on my Macbook Pro, and it works fine there.

Any clues why this won't work on Ubuntu?



That should be a string I believe.

Also there is something wrong with your nodejs installation. node and nodejs should be the same thing. How did you install nodejs?
What does apt policy nodejs show?
[Edit] Also which node and which nodejs



Thanks for your reply! :slight_smile:

I tried using a string as well, and the same flow works on my Mac. I think you are right that I have something wrong with nodejs.

I forgot to mention, that I manually installed nvm and then nodejs 8.11.1. This was because I read that the Telegram nodes only was tested to v8.11.1.

Here are the results from the commands, it seems like I have installed it on different users…?

which node

which nodejs

apt policy nodejs

  Installed: 8.14.0-1nodesource1
  Candidate: 8.14.0-1nodesource1
  Version table:
 *** 8.14.0-1nodesource1 500
        500 bionic/main amd64 Packages
        100 /var/lib/dpkg/status
     8.10.0~dfsg-2ubuntu0.4 500
        500 bionic-updates/universe amd64 Packages
     8.10.0~dfsg-2ubuntu0.2 500
        500 bionic-security/universe amd64 Packages
     8.10.0~dfsg-2 500
        500 bionic/universe amd64 Packages


I would get rid of the manually installed one, I am sure it will be ok with later versions.
On Ubuntu you can use the Pi install script to install/update node-red and that will give you a consistent set of tools to work with, and you can use it again if you want to upgrade. If you were going to do that though, get rid of the local one first.



OK thanks :slight_smile: But the reason I installed the older version in the first place was because of that very problem. So my question/errors still remain… :frowning:

What else might cause that?


On my Mac I have v8.11.0, maybe it's that simple. How do I downgrade successfully to that version on Ubuntu? I have gotten rid of the local one. (In the link you provided, I did not find any way to downgrade, but maybe I missed it?).



You don't need to downgrade, that isn't the issue. I'm using v8.13.0 on one Pi, 8.14.0 on another and v8.12.0 on my Windows 10 PC. All 3 devices run Node-RED and all 3 have different Telegram bots running on them successfully.

Do make sure that you only have each bot running on 1 device however. You cannot run the same bot connection on two different devices or indeed two different instances of Node-RED.



Thanks for the info, then I won't waste any time on that. I am not running the bot on any other devices (aside from trying on my Mac earlier) however.

Is there some dependencies that I might have on my Mac that's not installed by default on Ubuntu? Since it's working there.



I'm not aware of any dependencies that it needs but you could check the docs for the node. I certainly don't ever remember any dependencies. But then I've been using Telegram bots for quite a long time now. Though thinking about it, I only recently set up a telegram bot on my Windows dev PC which is fairly new - don't think I'd done it on this PC previously and I put a new install of Node-RED on it when I got it. I'm sure there were no dependencies. However, I always install build essentials and I'd always recommend getting your platform build tools installed before doing much with Node.JS.



OK. :slight_smile: I did not install anything else on my Mac either, but I figured that there maybe is some piece that does not come with Ubuntu that I'm missing? I have unfortunately already installed build essential and everything is up-to-date. :confused: Not quite sure what the platform build tools for my platform is though? Kind of new to this, if you have any links that would be appreciated.



Right, time to go back to basics.

Stop Node-RED if it is running, rename your userDir folder, npm uninstall -g node-red (and anything else you have installed globally). Then remove both copies of node and nvm. A reboot at this stage would probably be sensible.

Next, install node v8 latest using the instructions on the node website. Make sure it is working correctly.

Now install node-red according to the instructions. Make sure that is working correctly. Then install the telegram node, configure and try it out.