Telegram TDLib Client

Build Telegram user-account or bot applications in Delphi/C++Builder. Wraps the official Telegram TDLib to expose authentication, chats, messages and update events.

TsgcTDLib_Telegram

Delphi/C++Builder wrapper for the official Telegram TDLib (tdjson). Handles client_id lifecycle, authentication state, message send/receive and the long-poll update stream.

Component class

TsgcTDLib_Telegram

Protocol

Telegram TDLib

Platforms

Windows, macOS, Linux, iOS, Android

Edition

Standard / Professional / Enterprise

Set TDLib, authenticate, message

Set ApiId / ApiHash, point the component at the tdjson library, hook OnTelegramUpdate for authentication state and start sending messages.

uses
  sgcLibs;

var
  Telegram: TsgcTDLib_Telegram;
begin
  Telegram := TsgcTDLib_Telegram.Create(nil);
  Telegram.TDLibParameters.ApiId   := 123456;
  Telegram.TDLibParameters.ApiHash := 'your-api-hash';
  Telegram.LibraryPath := 'tdjson.dll';

  Telegram.OnTelegramUpdate := procedure(Sender: TObject;
    const aUpdate: string)
  begin
    Memo1.Lines.Add(aUpdate);
  end;

  Telegram.Active := True;
  Telegram.SendMessage('@username', 'hello from Delphi');
end;
// uses: sgcLibs
TsgcTDLib_Telegram *Telegram = new TsgcTDLib_Telegram(this);
Telegram->TDLibParameters->ApiId   = 123456;
Telegram->TDLibParameters->ApiHash = "your-api-hash";
Telegram->LibraryPath = "tdjson.dll";

Telegram->Active = true;
Telegram->SendMessage("@username", "hello from Delphi");

What's inside

A Delphi facade over the official TDLib (tdjson) shared library — same protocol the official Telegram clients use.

Authentication flow

The component drives the TDLib authentication state machine: phone number, code, optional 2FA password, and persists the session under the local database directory.

Send messages

SendMessage, SendPhoto, SendVideo, SendDocument, SendVoiceNote and other typed methods cover the TDLib message-content types.

Chats & contacts

GetChats, GetChat, SearchPublicChat and GetUser expose the Telegram address book and joined channels/groups as typed responses.

Update stream

OnTelegramUpdate delivers every TDLib updateXxx event — new messages, user typing, channel posts, edits, deletions — as raw JSON for downstream routing.

Native TDLib

Uses the official tdjson.dll / libtdjson.so / libtdjson.dylib — same end-to-end encryption guarantees as the official Telegram client.

Cross-platform

TDLib ships for Windows, macOS, Linux, Android and iOS. Configure LibraryPath per platform; the component handles the typed bridging for you.

Specifications & references

Authoritative sources for the API this component implements.

Documentation & Demos

Deep-link to the component reference, grab the ready-to-run demo project, and download the trial.

Online Help — API_Telegram Full property, method and event reference for this component.
Demo Project — Demos\50.Other\01.Telegram_Client Ready-to-run example project. Ships inside the sgcWebSockets package — download the trial below.
Technical Document (PDF) Features, quick start, code samples for Delphi & C++ Builder and primary-source references — this component only.
User Manual (PDF) Comprehensive manual covering every component in the library.

Ready to Build a Telegram Client?

Download the free trial and add Telegram messaging to your Delphi applications.