{"id":20982425,"url":"https://github.com/juliaaplavin/telegramclient.jl","last_synced_at":"2026-02-22T23:35:33.403Z","repository":{"id":238906075,"uuid":"759482611","full_name":"JuliaAPlavin/TelegramClient.jl","owner":"JuliaAPlavin","description":"Julia client for Telegram API using TDLib.","archived":false,"fork":false,"pushed_at":"2025-10-26T12:55:17.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-31T00:39:50.051Z","etag":null,"topics":["messaging","tdlib","telegram","telegram-api"],"latest_commit_sha":null,"homepage":"","language":"Julia","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JuliaAPlavin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-02-18T18:00:22.000Z","updated_at":"2025-07-05T21:06:10.000Z","dependencies_parsed_at":"2025-08-02T21:14:58.909Z","dependency_job_id":"369c6799-e6ec-43fd-a34a-66c32ba63594","html_url":"https://github.com/JuliaAPlavin/TelegramClient.jl","commit_stats":null,"previous_names":["juliaaplavin/telegramclient.jl"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/JuliaAPlavin/TelegramClient.jl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaAPlavin%2FTelegramClient.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaAPlavin%2FTelegramClient.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaAPlavin%2FTelegramClient.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaAPlavin%2FTelegramClient.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JuliaAPlavin","download_url":"https://codeload.github.com/JuliaAPlavin/TelegramClient.jl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaAPlavin%2FTelegramClient.jl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29730790,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T20:09:16.275Z","status":"ssl_error","status_checked_at":"2026-02-22T20:09:13.750Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["messaging","tdlib","telegram","telegram-api"],"created_at":"2024-11-19T05:45:33.834Z","updated_at":"2026-02-22T23:35:33.382Z","avatar_url":"https://github.com/JuliaAPlavin.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003ca id='Overview'\u003e\u003c/a\u003e\n\n\u003ca id='Overview-1'\u003e\u003c/a\u003e\n\n# Overview\n\n\nJulia wrapper for the Telegram library [TDLib](https://core.telegram.org/tdlib):\n\n\n\u003e TDLib (Telegram Database Library) is a cross-platform, fully functional Telegram client. We designed it to help third-party developers create their own custom apps using the Telegram platform.\n\n\n\nRelies on `TDLib_jll` package to provide TDLib binaries.\n\n\n\u003ca id='Usage'\u003e\u003c/a\u003e\n\n\u003ca id='Usage-1'\u003e\u003c/a\u003e\n\n# Usage\n\n\n```julia-repl\njulia\u003e cd(joinpath(@__DIR__, \"../test/\")) # assuming tdlib already run in test dir, it won't ask for auth code again\n```\n\n\n`TelegramClient.jl` doesn't export anything, so simply import the package and use qualified function names:\n\n\n```julia-repl\njulia\u003e import TelegramClient as TG\n```\n\n\nSome methods can be executed without even creating a `Client`:\n\n\n```julia-repl\njulia\u003e TG.execute_method(:setLogVerbosityLevel, new_verbosity_level=0) |\u003e copy\nDict{Symbol, Any} with 1 entry:\n  Symbol(\"@type\") =\u003e \"ok\"\n\njulia\u003e TG.execute_method(:getLogVerbosityLevel) |\u003e copy\nDict{Symbol, Any} with 2 entries:\n  :verbosity_level =\u003e 0\n  Symbol(\"@type\")  =\u003e \"logVerbosityLevel\"\n```\n\n\nAuthentication parameters can be filled in manually in the `AuthParameters` struct or read from a JSON file:\n\n\n```json\n{\n    \"api_id\": ***,\n    \"api_hash\": \"***\",\n    \"phone_number\": \"***\"\n}\n```\n\n\nHere, we read it from file:\n\n\n```julia-repl\njulia\u003e import JSON3\n\njulia\u003e auth_file = \"auth_params.json\";\n\njulia\u003e auth_parameters = JSON3.read(read(auth_file, String), TG.AuthParameters);\n```\n\n\nCreate a client with these auth parameters:\n\n\n```julia-repl\njulia\u003e tg = TG.Client(; auth_parameters);\n```\n\n\nAlternatively, an auto-closing wrapper is provided:\n\n\n```julia\njulia\u003e TG.Client(; auth_parameters) do tg\n           ...\n       end\n```\n\n\nCurrently, this wrapper does nothing in the end as there are no functions to close the client in the TDLib API. However, this may change in the future.\n\n\nSettings can be set by passing them to the constructor: `TG.Client(settings=TG.Settings(...))`. Default values:\n\n\n```julia-repl\njulia\u003e Dict(TG.Settings())\nDict{Symbol, Any} with 10 entries:\n  :use_message_database     =\u003e false\n  :database_directory       =\u003e \"tdlib\"\n  :system_version           =\u003e \"Linux\"\n  :use_secret_chats         =\u003e false\n  :use_file_database        =\u003e false\n  :device_model             =\u003e \"Desktop\"\n  :application_version      =\u003e \"1.0\"\n  :system_language_code     =\u003e \"en\"\n  :use_chat_info_database   =\u003e false\n  :enable_storage_optimizer =\u003e true\n```\n\n\nNow we can call an API method:\n\n\n```julia-repl\njulia\u003e TG.send_method(tg, :getOption, name=\"version\")\n```\n\n\nand receive its result:\n\n\n```julia-repl\njulia\u003e TG.receive(tg, timeout=1) |\u003e copy\nDict{Symbol, Any} with 4 entries:\n  :value               =\u003e Dict{Symbol, Any}(:value=\u003e\"1.7.4\", Symbol(\"@type\")=\u003e\"…\n  :name                =\u003e \"version\"\n  Symbol(\"@client_id\") =\u003e 1\n  Symbol(\"@type\")      =\u003e \"updateOption\"\n```\n\n\nTimeouts are always specified in seconds.\n\n\nThe created `Client` is not ready to use yet:\n\n\n```julia-repl\njulia\u003e TG.is_ready(tg)\nfalse\n```\n\n\nHaving created a `Client`, perform its connection and authorization workflow:\n\n\n```julia-repl\njulia\u003e TG.connect_authorize(tg, timeout_each=1);\n```\n\n\nThis may ask for the authentication code if connecting for the first time. By default, the code is asked interactively via `Base.prompt()`. This can be changed in an  `AuthParameters` field: `AuthParameters(..., get_authentication_code=() -\u003e Base.prompt(\"Authentication code\"))`.\n\n\nThe client is finally ready:\n\n\n```julia-repl\njulia\u003e TG.is_ready(tg)\ntrue\n```\n\n\nNow, one can call any API methods with `send`, `send_method`, `execute`, `execute_method`, and receive responses or updates with `receive`.\n\n\n```julia-repl\njulia\u003e cd(joinpath(@__DIR__, \"../docs/\")) # restore current dir\n```\n\n\n\u003ca id='Reference'\u003e\u003c/a\u003e\n\n\u003ca id='Reference-1'\u003e\u003c/a\u003e\n\n# Reference\n\n\u003ca id='TelegramClient.connect_authorize-Tuple{Any}' href='#TelegramClient.connect_authorize-Tuple{Any}'\u003e#\u003c/a\u003e\n**`TelegramClient.connect_authorize`** \u0026mdash; *Method*.\n\n\n\n```julia\nconnect_authorize(client::Any; timeout_each)\n\n```\n\nPerform the TDLib connection and authorization sequence.\n\n`client` must contain valid authorization parameters. `timeout_each` is the timeout for each internal `receive` call. Returns all events received in the process, in case they are useful for the application.\n\n\n\u003ca target='_blank' href='https://github.com/aplavin/TelegramClient.jl/blob/b677a4debe657ce6b14cced0ba37062093ba5898/src/connect_auth.jl#L49' class='documenter-source'\u003esource\u003c/a\u003e\u003cbr\u003e\n\n\u003ca id='TelegramClient.execute-Tuple{Dict}' href='#TelegramClient.execute-Tuple{Dict}'\u003e#\u003c/a\u003e\n**`TelegramClient.execute`** \u0026mdash; *Method*.\n\n\n\n```julia\nexecute(query::Dict) -\u003e JSON3.Object\n\n```\n\nCall TDLib `execute` function, converting the input to JSON and the result from JSON. \n\n\n\u003ca target='_blank' href='https://github.com/aplavin/TelegramClient.jl/blob/b677a4debe657ce6b14cced0ba37062093ba5898/src/api_raw.jl#L1' class='documenter-source'\u003esource\u003c/a\u003e\u003cbr\u003e\n\n\u003ca id='TelegramClient.execute_method-Tuple{Symbol, Dict}' href='#TelegramClient.execute_method-Tuple{Symbol, Dict}'\u003e#\u003c/a\u003e\n**`TelegramClient.execute_method`** \u0026mdash; *Method*.\n\n\n\n```julia\nexecute_method(method::Symbol, params::Dict) -\u003e JSON3.Object\n\n```\n\nConvenience function: calls `execute` with `\"@type\"=method` added to provided params. \n\n\n\u003ca target='_blank' href='https://github.com/aplavin/TelegramClient.jl/blob/b677a4debe657ce6b14cced0ba37062093ba5898/src/api_raw.jl#L50' class='documenter-source'\u003esource\u003c/a\u003e\u003cbr\u003e\n\n\u003ca id='TelegramClient.is_ready-Tuple{TelegramClient.Client}' href='#TelegramClient.is_ready-Tuple{TelegramClient.Client}'\u003e#\u003c/a\u003e\n**`TelegramClient.is_ready`** \u0026mdash; *Method*.\n\n\n\n```julia\nis_ready(client::TelegramClient.Client) -\u003e Bool\n\n```\n\nReturns whether the client is ready to use: connected and authorized. \n\n\n\u003ca target='_blank' href='https://github.com/aplavin/TelegramClient.jl/blob/b677a4debe657ce6b14cced0ba37062093ba5898/src/client.jl#L52' class='documenter-source'\u003esource\u003c/a\u003e\u003cbr\u003e\n\n\u003ca id='TelegramClient.receive-Tuple{TelegramClient.Client}' href='#TelegramClient.receive-Tuple{TelegramClient.Client}'\u003e#\u003c/a\u003e\n**`TelegramClient.receive`** \u0026mdash; *Method*.\n\n\n\n```julia\nreceive(client::TelegramClient.Client; kwargs...)\n\n```\n\nCall TDLib `receive` function with the specified `timeout`, converting the result from JSON.\n\nCompared to the `receive()` method, this raises an error when the response doesn't correspond to the provided `client`.\n\n\n\u003ca target='_blank' href='https://github.com/aplavin/TelegramClient.jl/blob/b677a4debe657ce6b14cced0ba37062093ba5898/src/api_raw.jl#L39' class='documenter-source'\u003esource\u003c/a\u003e\u003cbr\u003e\n\n\u003ca id='TelegramClient.receive-Tuple{}' href='#TelegramClient.receive-Tuple{}'\u003e#\u003c/a\u003e\n**`TelegramClient.receive`** \u0026mdash; *Method*.\n\n\n\n```julia\nreceive(; timeout)\n\n```\n\nCall TDLib `receive` function with the specified `timeout`, converting the result from JSON.\n\nNote that `receive` may return an event for any `Client`, if multiple are created. Either check this yourself, or use the `receive(client)` method.\n\n\n\u003ca target='_blank' href='https://github.com/aplavin/TelegramClient.jl/blob/b677a4debe657ce6b14cced0ba37062093ba5898/src/api_raw.jl#L22' class='documenter-source'\u003esource\u003c/a\u003e\u003cbr\u003e\n\n\u003ca id='TelegramClient.send-Tuple{TelegramClient.Client, Dict}' href='#TelegramClient.send-Tuple{TelegramClient.Client, Dict}'\u003e#\u003c/a\u003e\n**`TelegramClient.send`** \u0026mdash; *Method*.\n\n\n\n```julia\nsend(client::TelegramClient.Client, query::Dict)\n\n```\n\nCall TDLib `send` function, converting the input to JSON. Doesn't return anything. \n\n\n\u003ca target='_blank' href='https://github.com/aplavin/TelegramClient.jl/blob/b677a4debe657ce6b14cced0ba37062093ba5898/src/api_raw.jl#L14' class='documenter-source'\u003esource\u003c/a\u003e\u003cbr\u003e\n\n\u003ca id='TelegramClient.send_method-Tuple{TelegramClient.Client, Symbol, Dict}' href='#TelegramClient.send_method-Tuple{TelegramClient.Client, Symbol, Dict}'\u003e#\u003c/a\u003e\n**`TelegramClient.send_method`** \u0026mdash; *Method*.\n\n\n\n```julia\nsend_method(client::TelegramClient.Client, method::Symbol, params::Dict)\n\n```\n\nConvenience function: calls `send_method` with `\"@type\"=method` added to provided params. \n\n\n\u003ca target='_blank' href='https://github.com/aplavin/TelegramClient.jl/blob/b677a4debe657ce6b14cced0ba37062093ba5898/src/api_raw.jl#L54' class='documenter-source'\u003esource\u003c/a\u003e\u003cbr\u003e\n\n\u003ca id='TelegramClient.AuthParameters' href='#TelegramClient.AuthParameters'\u003e#\u003c/a\u003e\n**`TelegramClient.AuthParameters`** \u0026mdash; *Type*.\n\n\n\n  * `api_id::Int64`\n  * `api_hash::String`\n  * `phone_number::String`\n  * `encryption_key::String`\n  * `get_authentication_code::Function`\n  * `get_password::Function`\n\nTDLib authentication parameters.\n\nObtain the API ID and hash from Telegram, and put it here together with your account phone number. \n\n\n\u003ca target='_blank' href='https://github.com/aplavin/TelegramClient.jl/blob/b677a4debe657ce6b14cced0ba37062093ba5898/src/client.jl#L20' class='documenter-source'\u003esource\u003c/a\u003e\u003cbr\u003e\n\n\u003ca id='TelegramClient.Client' href='#TelegramClient.Client'\u003e#\u003c/a\u003e\n**`TelegramClient.Client`** \u0026mdash; *Type*.\n\n\n\n  * `settings::TelegramClient.Settings`\n  * `auth_parameters::TelegramClient.AuthParameters`\n  * `tdlib_id::Int64`\n  * `is_authorized::Bool`\n  * `is_connected::Bool`\n  * `last_state::Union{Nothing, String}`\n\nTelegram client struct.\n\nContains TDLib settings, authentication parameters, and its current state. \n\n\n\u003ca target='_blank' href='https://github.com/aplavin/TelegramClient.jl/blob/b677a4debe657ce6b14cced0ba37062093ba5898/src/client.jl#L35' class='documenter-source'\u003esource\u003c/a\u003e\u003cbr\u003e\n\n\u003ca id='TelegramClient.Settings' href='#TelegramClient.Settings'\u003e#\u003c/a\u003e\n**`TelegramClient.Settings`** \u0026mdash; *Type*.\n\n\n\n  * `database_directory::String`\n  * `use_file_database::Bool`\n  * `use_chat_info_database::Bool`\n  * `use_message_database::Bool`\n  * `enable_storage_optimizer::Bool`\n  * `use_secret_chats::Bool`\n  * `system_language_code::String`\n  * `device_model::String`\n  * `system_version::String`\n  * `application_version::String`\n\nTDLib settings. They are sent to the library as-is. \n\n\n\u003ca target='_blank' href='https://github.com/aplavin/TelegramClient.jl/blob/b677a4debe657ce6b14cced0ba37062093ba5898/src/client.jl#L5' class='documenter-source'\u003esource\u003c/a\u003e\u003cbr\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliaaplavin%2Ftelegramclient.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuliaaplavin%2Ftelegramclient.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliaaplavin%2Ftelegramclient.jl/lists"}