Files And HTTP
The client sends JSON for normal Telegram requests and multipart form data when any InputFile value is present. This includes nested arrays such as media payloads for sendMediaGroup.
Upload A Document
Upload A Media Group
The package converts nested files to Telegram attach:// references and adds the file streams to the multipart body. Files are opened lazily by PSR-7 streams during the HTTP request.
Use Existing Telegram File IDs
If Telegram already has the file, pass the file ID string instead of InputFile:
Custom HTTP Client In Laravel
Bind GuzzleHttp\ClientInterface before the Telegram client is resolved:
The package always disables Guzzle HTTP exceptions per request so Telegram ok: false responses keep their API metadata.
Direct Client Construction
Local Bot API Server
Telegram supports running a local Bot API server for large uploads, local file paths, HTTP webhooks, local IP webhooks, and higher webhook connection limits. When using it, set TELEGRAM_BOT_API_URL to the local server base URL and keep the same bot token configuration.
Review Telegram's official Bot API documentation before switching to a local server, because file behavior and webhook behavior differ from the public https://api.telegram.org service.
Response Contract
Telegram successful responses contain:
Failed responses contain:
The package validates this shape. Successful responses without result, failed responses without description, non-JSON responses, and transport failures raise TelegramBotTransportException. Telegram ok: false responses raise TelegramBotApiException.