Telegram Bot with mega

Hello friends!

I would like to implement the telegram bot in my project.

The project is large and it is operating in an Arduino Mega. Therefore what I need is to use the module ESP8266 (which I just received) to provided access to internet to the Arduino Mega.

However, all Telegram bot tutorials that I checked upload the code to the ESP8266 directly (using arduino only to flash the program in the esp). Instead, what I need is the Arduino Mega to run the program and the external esp module to stablish internet connection.

Anyone has an idea whether it is possible to make it work like that?

Thank you very much in advance.