You are reading a single comment by @Crash and its replies. Click here to read the full conversation.
  • Hi guys,

    i try to send a messages from the ESP8266-01 by using the espruino firmware.

    >process.env
    ={
      VERSION: "2v03",
      GIT_COMMIT: "e77d74f6",
      BOARD: "ESP8266_BOARD",
      FLASH: 0, RAM: 81920,
      SERIAL: "807d3a69-78f3",
      CONSOLE: "Telnet",
      MODULES: "Flash,Storage,hea" ... "r,crypto,neopixel",
      EXPTR: 1073643636 }
    

    The wifi connection is established successfully.

     	var request = http.get(encodeURIComponent("http://api.­telegram.org/bot{REPLACED_WITH_TOKEN}/se­ndMessage?chat_id={REPLACE_WITH_MY_ID}&t­ext=HI"), function(res) {
    		res.on('data', function(data) {
    			console.log("RESPONSE:", data);
    		});
          res.on('close', function() { 
            console.log(res);
          });
    	});
      console.log(request);
      request.on('error', (err) => {
      console.log(err);
    });
    

    Response of the error case:

    { "code": -6,
      "message": "not found"
     }
    

    After that I try to send a message via GET or POST to the telegram bot.
    Unfortunately I always get error messages. I am not sure if the requests arrive at telegram at all.
    Can someone give me a hint?

    I have already found a module in the internet. But that also do not work.
    http://wiki.amperka.ru/js:telegram

    Edit: If I just open the url in the browser the request will send and the telegram bot has the message.

  • Can you get a 200 response using a tool like Postman or Insomnia with the same endpoint? That's the first thing I'd check. That error suggests host is not found.

    Also, but without knowing, I'd also check whether http is supported by Telegram. I would expect an API like that to use https (in which case you have a problem on ESP8266).

About

Avatar for Crash @Crash started