# mahadihasan9/esp32telegrambot architecture

> Architecture diagram of the GitHub repository mahadihasan9/esp32telegrambot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mahadihasan9/esp32telegrambot
- Repository: https://github.com/mahadihasan9/esp32telegrambot

## Overview

ESP32TelegramBot is an Arduino library for polling Telegram updates and sending text messages over HTTPS. The principal workflow is an application calling the bot, which fetches updates through Transport, parses selected message fields, and returns a getJson container; applications can also send replies through the bot. The graph covers the sampled implementation and README-documented API. The example’s command handling and LED behavior are application logic, not library components.

Main entry points: [`src/ESP32TelegramBot.cpp`](https://github.com/mahadihasan9/esp32telegrambot/blob/main/src/ESP32TelegramBot.cpp) (Bot operations), [`src/Transport.cpp`](https://github.com/mahadihasan9/esp32telegrambot/blob/main/src/Transport.cpp) (HTTPS requests), [`src/getJson.cpp`](https://github.com/mahadihasan9/esp32telegrambot/blob/main/src/getJson.cpp) (Update container), [`src/TelegramConfig.h`](https://github.com/mahadihasan9/esp32telegrambot/blob/main/src/TelegramConfig.h) (Limits and timeout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bot_api["Bot API"]
  node_bot["Bot operations"]
  node_config["Limits and timeout<br/>[TelegramConfig.h]"]
end

subgraph group_network["HTTPS Transport"]
  node_transport["HTTPS requests<br/>[Transport.cpp]"]
end

subgraph group_message_support["Message And Errors"]
  node_message["Update container<br/>[getJson.cpp]"]
  node_errors["Error codes<br/>[TelegramError.h]"]
end

node_application(("Arduino application"))
node_telegram["Telegram Bot API"]
node_wifi["ESP32 WiFi"]

node_application -->|"calls API"| node_bot
node_bot -->|"requests updates"| node_transport
node_bot -->|"sends messages"| node_transport
node_transport -->|"HTTPS requests"| node_telegram
node_transport -->|"checks connection"| node_wifi
node_bot -->|"checks connection"| node_wifi
node_bot -->|"fills and returns"| node_message
node_bot -->|"sets error status"| node_errors
node_bot -->|"uses defaults"| node_config
node_message -->|"returns update"| node_application
node_application -->|"reads error status"| node_bot

click node_bot "https://github.com/mahadihasan9/esp32telegrambot/blob/main/src/ESP32TelegramBot.cpp"
click node_config "https://github.com/mahadihasan9/esp32telegrambot/blob/main/src/TelegramConfig.h"
click node_transport "https://github.com/mahadihasan9/esp32telegrambot/blob/main/src/Transport.cpp"
click node_message "https://github.com/mahadihasan9/esp32telegrambot/blob/main/src/getJson.cpp"
click node_errors "https://github.com/mahadihasan9/esp32telegrambot/blob/main/src/TelegramError.h"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_bot,node_config toneBlue
class node_transport toneAmber
class node_message,node_errors,node_telegram toneMint
class node_application,node_wifi toneIndigo
```

## Components

### Bot API

- [Bot operations](https://github.com/mahadihasan9/esp32telegrambot/blob/main/src/ESP32TelegramBot.cpp): `src/ESP32TelegramBot.cpp`
- [Limits and timeout](https://github.com/mahadihasan9/esp32telegrambot/blob/main/src/TelegramConfig.h): `src/TelegramConfig.h`

### HTTPS Transport

- [HTTPS requests](https://github.com/mahadihasan9/esp32telegrambot/blob/main/src/Transport.cpp): `src/Transport.cpp`

### Message And Errors

- [Update container](https://github.com/mahadihasan9/esp32telegrambot/blob/main/src/getJson.cpp): `src/getJson.cpp`
- [Error codes](https://github.com/mahadihasan9/esp32telegrambot/blob/main/src/TelegramError.h): `src/TelegramError.h`

### Other components

- **Arduino application**
- **Telegram Bot API**
- **ESP32 WiFi**

## Connections

- Arduino application → Bot operations: calls API (evidence: `README.md`)
- Bot operations → HTTPS requests: requests updates (evidence: `src/ESP32TelegramBot.cpp`)
- Bot operations → HTTPS requests: sends messages (evidence: `src/ESP32TelegramBot.cpp`)
- HTTPS requests → Telegram Bot API: HTTPS requests (evidence: `src/Transport.cpp`)
- HTTPS requests → ESP32 WiFi: checks connection (evidence: `src/Transport.cpp`)
- Bot operations → ESP32 WiFi: checks connection (evidence: `src/ESP32TelegramBot.cpp`)
- Bot operations → Update container: fills and returns (evidence: `src/ESP32TelegramBot.cpp`)
- Bot operations → Error codes: sets error status (evidence: `src/ESP32TelegramBot.cpp`)
- Bot operations → Limits and timeout: uses defaults
- Update container → Arduino application: returns update (evidence: `README.md`)
- Arduino application → Bot operations: reads error status (evidence: `README.md`)
