shurillu / CTBot

A simple (and easy to use) Arduino Telegram BOT Library for ESP8266/ESP32
MIT License
147 stars 34 forks source link

Unable to connect to Telegram server after April 27 #93

Closed hamster66 closed 2 years ago

hamster66 commented 2 years ago

Hi After April 27, the library does not connect to the telegram server. The code did not change, everything worked well for several years. (ESP8266) In debugging I see the following message:

--->connect: WiFi connected
--->connect: IP address: 192.168.1.243
--->connect: Unable to connect to Telegram server
--->sendCommand: Header
POST https://api.telegram.org/botxxxxxxxxxxxxx/getMe HTTP/1.1
Host: api.telegram.org
Content-Length: 5
Content-Type: application/json

--->sendCommand: Payload
null

testConnection NOK
--->connect: Unable to connect to Telegram server
--->sendCommand: Header
POST https://api.telegram.org/botxxxxxxxx/getUpdates HTTP/1.1
Host: api.telegram.org
Content-Length: 76
Content-Type: application/json

Please, help!!!

Araris commented 2 years ago

Exactly the same situation from yesterday, myBot.testConnection() returns false. Version CTBot-3.0.0 (04.09.2021)

shurillu commented 2 years ago

Hello, I'll check ASAP.

Stefano

mjtrini commented 2 years ago

Same issue with me here in the Caribbean. Perhaps Telegram performed some updates and now the CTBot cannot connect?

bbird8 commented 2 years ago

Confirmed. Same issue here.

gcardo commented 2 years ago

same here

shurillu commented 2 years ago

Hello to all, the issue seem to be related to an "out of date" fingerprint for HTTPS authentication. This involves only the ESP8266 boards because the ESP32 uses the HTTPS certificate for authentication. Anyway, I'm drafting a new release very soon with the new fingerprint. Meanwhile here a quick fix:

    uint8_t newFingerprint[20]{ 0x07, 0x36, 0x89, 0x3D, 0x0F, 0xCC, 0x8C, 0xF7, 0xD0, 0x19, 0xB7, 0x83, 0x39, 0xC4, 0xD5, 0x15, 0x70, 0x9A, 0xC6, 0x5D };
    myBot.setFingerprint(newFingerprint);

Simply add this two lines in the same place where you initialize the bot (after the token assignment is fine). This should fix the problem.

I tested it with:

Obviously you need to recompile&upload a new firmware with the updated fingerprint. Please let me know if this fix solve the issue (as I believe).

Cheers Stefano

bbird8 commented 2 years ago

Yep - I can confirm that the fix works :) Thanks!

shurillu commented 2 years ago

Good! I just drafted the new release (v2.1.9) and updated the v3.0.0 in the his own branch.

Stefano

Araris commented 2 years ago

Stefano, many thanks to you !

dbunshin commented 2 years ago

thank you stefano

gcardo commented 2 years ago

Thanks Stefano!

mjtrini commented 2 years ago

I haven't tested it yet but much thanks Stefano!

hamster66 commented 2 years ago

Thank you Stefano! You are best! :)

shurillu commented 2 years ago

Good: issue solved so I close it. Feel free to reopen it if something goes wrong.

DumahBrazorf commented 2 years ago

Yeah this should be sticked in the home page. Basically every older version than 2.19 won't work anymore with the ESP8266 unless adding the 2lines code trick.