Digging into ArduinoIoTCloud library, with Opta board, seems already included the bearssl framework and I suppose it's not compatible with ClientSSL togheter.
But this means that you have support for SSL connection through the ArduinoIoTCloud dependencies and this is good because you can use another BearSSLClient client also with Telegram.
The question now is, how can you use the Telegram SSL certificate with this client?
Looking at the source of BearSSLClient, the constructor is written in this manner:
BearSSLClient(Client* client, const br_x509_trust_anchor* myTAs, int myNumTAs, GetTimeCallbackFunc func);
It's very similar to ClientSSL indeed.
I've tried this code and compiled with success, try and let us know it it works finally!
#include <WiFi.h>
#include <AsyncTelegram2.h>
#include <ArduinoIoTCloud.h>
#include <Arduino_ConnectionHandler.h>
#include <tg_certificate.h>
WiFiClient base_client;
int status = WL_IDLE_STATUS;
unsigned long myGetTime() {
return ArduinoCloud.getInternalTime();
}
BearSSLClient client(&base_client, TAs, (size_t)TAs_NUM, myGetTime);
AsyncTelegram2 myBot(client);
..... the rest is the same