Skip to content

Latest commit

 

History

211 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Ferogram

A Native & Elegant MTProto Framework for Rust

Crates.io docs.rs Dependencies License Telegram

Built by Ankit Chaubey

Overview

Modern APIs. Native MTProto. Ferogram helps you build fast, powerful Telegram applications for both bots and user accounts without compromising on flexibility.

From messaging and media to transfers, calls, MTProxy, and much more, Ferogram brings everything together in one elegant framework.

Let's build something amazing. High-level APIs where you want them, raw invoke() where you need complete control.


Getting started

All it takes is a single line in your Cargo.toml.

[dependencies]
ferogram = "0.6.5"

Development on GitHub moves faster than crates.io. If you need something from main, you can point directly to a specific commit:

ferogram = { git = "https://github.com/ankit-chaubey/ferogram", rev = "COMMIT_SHA" }

Otherwise, stable from crates.io is the safe default.


Quick start

use ferogram::Client;

const API_ID: i32 = 0;
const API_HASH: &str = "";

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let (client, _) = Client::quick_connect("my.session", API_ID, API_HASH).await?;

    client.send_message("me", "Hello from ferogram!").await?;
    Ok(())
}

Python support

Love Python as much as we do? Ferogram is also available for Python with a clean, user-friendly API while keeping the heavy lifting in Rust.

Powered by same high-performance Rust core, it takes care of networking, encryption, TL parsing, and session management. Explore the ferogram python source, learn about its architecture, or install the pre-built wheels for your platform from PyPI, no Rust toolchain needed.

All you need is:

pip install ferogram

Features

  • TgCalls: Voice and video calling for Telegram clients, wrapping Telegram's native calling stack in a Rust API for joining voice chats and streaming audio or video. See tgcalls.

  • Dispatcher & Filters: A flexible update dispatcher with composable filters (&, |, !) for building expressive and maintainable handlers.

  • FSM: A type-safe finite state machine for multi-step conversations, featuring pluggable storage backends and configurable state strategies. See ferogram-fsm.

  • Session Backends: Binary file storage by default, with built-in support for SQLite, LibSQL (Turso), and base64 sessions. Custom storage backends can be implemented via SessionBackend.

  • MTProxy: Native support for Classic, DD, and FakeTLS MTProxy transports.

  • Raw API: Access the complete Telegram MTProto API by invoking any TL function directly with client.invoke(), giving you full control whenever the high-level API doesn't cover a use case.

...and more features like this throughout the codebase!


AI usages

AI was used in some parts of Ferogram's development, just like any other tools, wherever it made sense and genuinely helped. The project's architecture, direction, implementation decisions, experimentation, and testing are my own work.

Read "Why Ferogram?" to understand why I created another MTProto library.


Community and links

Join the ferogram community! Questions, discussions, bugs report and feedback are always welcome.

See what's covered for the quick feature list, or try the examples to see it in action.

If something is missing, feel free to open a feature request or share your ideas.

License

This project is dual-licensed under:

  • MIT License
  • Apache License 2.0

You may choose either license.

You are free to use, modify, and distribute this software, including for commercial use, provided the original license and copyright notice are included.

See LICENSE-MIT and LICENSE-APACHE for full details.

Usage must comply with Telegram's API's Terms.

About

A native, elegant, and asynchronous MTProto framework in Rust for Telegram clients, bots, and applications.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

31 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages