Getting an error related to telegram receiver node

Hello Experts,

I have newly installed node-red in Ubuntu 20 OS successfully. I have installed node-red-contrib-telegrambot package from npm too. But when I am simply importing "receiver" node of teelgram its keep giving error, details of node and error are as follows:

Node:
image

Errors:
In server logs:
telegram" 18 Feb 12:05:26 - [warn] [telegram bot:hex_decimal id] Unknown error. Trying again.

In UI logs:
ETELEGRAM: 404 Not Found

I have tried searching Online and in here forums but didn't get much on this one, my node-red project has NOTHING apart from this only node, any help/guidance is greatly appreciated.

Thanks,
Ravinder Singh

What versions of nodejs and node-red did you install?

Does the Ubuntu have internet access?

Have you setup a bot and entered the API key?

Lastly, what do you mean by "when I am simply importing "receiver" node of teelgram its keep giving error"? Can you describe in steps what you do and where you see this error?

1 Like

Hello @Steve-Mcl ,

Thanks for your time here, following are the answers on your questions:

Yes, its an aws server and similar setup for me running fine for another aws server(inbound rules are added and port 1880 is opened to take traffic since I can hit link in browser).

Yes I have created a bot from "Bot father" and entered token provided by it into config, I didn't share it since I thought it could be a security issue etc.

I mean I am getting 2 errors, one ETELEGRAM: 404 Not Found on node-red UI side(after applying verbose logging option of telegram receiver) and another in server /var/syslogs is the location and error is: "telegram" 18 Feb 12:05:26 - [warn] [telegram bot:hex_decimal id] Unknown error. Trying again..

Kindly do let me know if any other information is required, cheers.

NOTE: There is nothing present in this project apart from this node and yet its giving this error, just adding this point here.

Thanks,
Ravinder Singh

Telegram doesn't communicate to the telegram servers on port 1880. It goes out (from the node-red server) to https://api.telegram.org - does your setup permit https requests to go out of the node environment?

1 Like

Thank you for your response @Steve-Mcl , yes I could see I can wget to link your link, if that is what you meant.

wget https://api.telegram.org
HTTP request sent, awaiting response... 200 OK
Length: 40198 (39K) [text/html]
Saving to: ‘index.html’

Thanks,
Ravinder Singh

Yes, thats good but can node-red make the request?

try a HTTP Request node - see if you get a 200 response.

Also, can you answer my questions...

1 Like

For your suggestion:
try a HTTP Request node - see if you get a 200 response.
could you please do guide me how to do so?

For node version when I do a node -v I get v10.19.0 AND for node-red I get Node-RED version: v2.2.1 .

For steps, I installed node js first then npm followed by node-red-contrib-telegrambot, then I logged into 1880 port UI of node-js, gone to manage pallets and installed again to UI node-red-contrib-telegrambot.

once these done I dragged and dropped telegram's receiver node and once I given all details for bot. token etc and deployed it, it started giving errors.

Thanks,
Ravinder Singh

This might be part of the problem.

Node-red v2+ has a minimum requirement of nodejs v12 (v10 is EOL)

For ubuntu, the recommendation is to use the installer script detailed in the node-red docs. You can still run the installer script & add --node14 to the end to force an upgrade.

1 Like

https://cookbook.nodered.org/http/#http-requests

1 Like

Thanks a TON @Steve-Mcl for sharing link, yes I have tested it and curl command gives me Good response.

curl http://localhost:1880/hello
<html>
    <head></head>
    <body>
        <h1>Hello World!</h1>
    </body>
</html>

So now the only option is I need to upgrade my node and npm also? Kindly confirm once and I could do the same, is it required to remove node, npm OR we can upgrade them itself? Thanks for your time and guidance here.

Thanks,
Ravinder Singh

Hello @Steve-Mcl,

I have updated node's version to node -v v14.19.0 and node version is v2.2.1. When I again installed node-red-contrib-telegrambot and try putting simple receiver it gives me same errors :frowning:

Could you please guide here, will be grateful to you.

Thanks,
Ravinder Singh

You have simply created an endpoint and tested it from localhost. That doesn't test node --> telegram. You were supposed to try using the http request node to test connectivity from your node-red instance to the telegram Https endpoint.

1 Like

Thanks @Steve-Mcl for answer. I have tried this code from link provided in previous posts. Could you please guide me on how exactly I could test that, I am sorry I am not getting it now to check from node to telegram check. Will be grateful go you :pray:

Thanks,
Ravinder Singh

I am simply trying to get you to confirm connectivity from node-red to telegram API to see if there is a communication path.

Import this example: Set the URL of a request : Node-RED & Set the URL to https://api.telegram.org. Do you get a status 200?

1 Like

Thanks @Steve-Mcl, I have used following json file for flow(only change link and rest is from your guided url).
[ { "id": "11167f67.5d5031", "type": "inject", "z": "44d1b5142cfbb4d4", "name": "cars on craigslist", "props": [ { "p": "payload" }, { "p": "topic", "vt": "str" } ], "repeat": "", "crontab": "", "once": true, "onceDelay": "20", "topic": "", "payload": "http://vancouver.craigslist.org/search/sss?format=rss&query=cars", "payloadType": "str", "x": 130, "y": 260, "wires": [ [ "70154cd4.de1444" ] ] } ]

And when I set frequency to 20 sec or so for inject node then I get following output in console:

<!DOCTYPE html>
<html class="">
  <head>
    <meta charset="utf-8">
    <title>Bots: An introduction for developers</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta property="description" content="Bots are third-party applications that run inside Telegram. Users can interact with bots by sending them messages, commands…">
    <meta property="og:title" content="Bots: An introduction for developers">
    <meta property="og:image" content="75f7c457f2561cbf84">
    <meta property="og:description" content="Bots are third-party applications that run inside Telegram. Users can interact with bots by sending them messages, commands…">
    <link rel="shortcut icon" href="/favicon.ico?4" type="image/x-icon" />

    <link href="/css/bootstrap.min.css?3" rel="stylesheet">
    
    <link href="/css/telegram.css?215" rel="stylesheet" media="screen">
    <style>
    </style>
  </head>
  <body class="preload">
    <div class="dev_page_wrap">
      <div class=...

I have set https://api.telegram.org in http_request node.

Thanks,
Ravinder Singh

Ok, so we seem to have established your node red instance can communicate to api.telegram.org

Now can you provide a step by step as asked previously. something like...

  1. open node-red editor
  2. drag an xxxxx telegrame node to workspace
  3. open the nodes edit dialog and set to this [ insert screenshot ] and my bot config to this [ insert screenshot with token and bot name redacted ]
  4. blah blah
  5. blah blah
  6. Press Deply
  7. Press Inject
    1. see error in debug [ insert screenshot ]
    2. see error in node-red console [ insert copy of error in log ]
1 Like

Thanks @Steve-Mcl, for your time and help here. Its a GREAT forum with knowledgeable people here , appreciate your help and guidance here :+1:

FYI please!! I have figured out the problem what it was.

actually error message(ETELEGRAM: 404 Not Found)which I understood later) was self explanatory(some how :slight_smile: ) So when I had to give token in receiver of telegram node I have given it after colon. Lets say, token isetcetc:abcdefghijkl so I have not given etcetc I missed it(may be because of newline bot father has given me, though its a miss which created this error).

I actually come across a thread in SO(stack overflow) where they mentioned to get details to telegram link its pattern should be like: https://api.telegram.org/bot_name:bot_token so when I read that it clicked into my mind and I re-checked my token then BINGO I found complete token and copy/pasted it and it worked fine then.

I am not having right now that SO link with me, will update it here if I get it. I again appreciate help of @Steve-Mcl and forum here :+1:

Cheers and happy learning.

Thanks,
Ravinder Singh

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