Has anyone worked on the LilyGo SIM800L with Telegram group? I managed to set the module to send message to the telegram grp, but unable to read for messages.
Dear all,
Just to update – I have managed to setup the LilyGo T-Call SIM800 ESP32 module to run Telegram Bot over 2G.
Hope this will benefit whoever is looking for a solution.
FYI..
//include files required
#include <TinyGsmClient.h>
#include <TinyGsmClientSIM800.h>
#include <ArduinoHttpClient.h>
#include “SSLClient.h”
#include <UniversalTelegramBot.h>
#include <ArduinoJson.h>
TinyGsmClient client(modem);
SSLClient telegramSSL(&client);
HttpClient bot_telegram = HttpClient(telegramSSL, hostname3, port0); // secure
UniversalTelegramBot bot(BOTtoken, bot_telegram); //secure
void setup()
telegramSSL.setCACert(TELEGRAM_CERTIFICATE_ROOT); // api.telegram.org
//setup telegram
bot.sendMessage(CHAT_ID, “Bot Started”, “”);
delay(3000);
bot_telegram.stop();
void loop() //put function inside loop if required
{
if (millis() > lastTimeBotRan + botRequestDelay) {
int numNewMessages = bot.getUpdates(bot.last_message_received + 1);
Serial.println(“New telegram message = ” +String(numNewMessages));
while(numNewMessages) {
Serial.println(“got response”);
handleNewMessages(numNewMessages);
numNewMessages = bot.getUpdates(bot.last_message_received + 1);
}
lastTimeBotRan = millis();
esp_task_wdt_reset(); // hardware watchdog to reset incase module hangs
bot_telegram.stop(); // close client after every check else server return with “chat not found”
delay(60000); // long delay – else esp32 keep on crashing
}