No description
Find a file
2026-07-30 00:09:22 -04:00
badger Version 1.6.0 2023-06-08 13:33:22 -04:00
config Wire OMEMO message handling 2026-07-28 23:14:32 -04:00
e2ee /omemo commands for transport and chats 2026-07-30 00:09:22 -04:00
persistence /omemo commands for transport and chats 2026-07-30 00:09:22 -04:00
telegram /omemo commands for transport and chats 2026-07-30 00:09:22 -04:00
test MAM support in MUCs 2025-08-12 17:29:13 -04:00
xmpp Implement OMEMO IQ queries 2026-07-29 01:32:16 -04:00
yamldb Save sessions on exit 2019-11-19 22:25:14 +02:00
.gitignore Add tdlib.Dockerfile 2024-04-09 19:08:37 -04:00
config.yml.example Wire OMEMO message handling 2026-07-28 23:14:32 -04:00
config_schema.json Wire OMEMO message handling 2026-07-28 23:14:32 -04:00
Dockerfile Go bindings for libomemo-c and libsignal-protocol-c 2026-07-28 00:38:46 -04:00
go.mod Abstract E2EE manager/registry 2026-07-28 19:10:01 -04:00
go.sum Abstract E2EE manager/registry 2026-07-28 19:10:01 -04:00
LICENSE Add Apache attack helicopter^W^W license 2022-02-08 16:38:44 -05:00
log.go Set logging level for Logrus and TDlib from config 2019-11-05 02:09:07 +02:00
log_test.go Tests for log constants 2019-11-12 20:02:06 +02:00
Makefile Wire OMEMO message handling 2026-07-28 23:14:32 -04:00
README.md Go bindings for libomemo-c and libsignal-protocol-c 2026-07-28 00:38:46 -04:00
staging.Dockerfile Go bindings for libomemo-c and libsignal-protocol-c 2026-07-28 00:38:46 -04:00
tdlib.Dockerfile Add tdlib.Dockerfile 2024-04-09 19:08:37 -04:00
telegabber.go Wire OMEMO message handling 2026-07-28 23:14:32 -04:00
telegabber_test.go Fix tests 2023-11-16 08:05:23 -05:00

Telegabber: like Zhabogram, but in Go!

Now it's native, more asynchronous, and does not require to mess your server up with a monstrous third-party interpreter.

The configuration file is compatible with Zhabogram 2.0, so you can easily copy your existing config.yml.

Build

Prerequisites: Go links the binary against the glibc version present in the system where the build process happens, so it should be less or equal to the version of glibc in the system where Telegabber will run.

  • Build TDLib according to TDLib build instructions. Roll back to commit 8d7bda00a535d1eda684c3c8802e85d69c89a14a if the compatibility got broken.

  • Install a Signal-protocol C library for OMEMO support - one of:

    • libomemo-c, the Dino project's fork that supports both legacy/siacs OMEMO and modern OMEMO (1/2). Packaged on Debian bookworm and later (and correspondingly recent Ubuntu/derivatives) as libomemo-c-dev - apt install libomemo-c-dev is all you need. This is the default Telegabber builds against.
    • libsignal-protocol-c, the pre-fork original, on distros that only package that one (e.g. Debian bullseye: apt install libsignal-protocol-c-dev). It only supports legacy/siacs OMEMO, not modern OMEMO 1/2. Build with make GOTAGS=signal_legacy (or go build -tags signal_legacy ...) to link against it instead.

    Neither package available for your distro? Build either one from source the same way:

    git clone https://github.com/dino/libomemo-c   # or .../signalapp/libsignal-protocol-c
    cd libomemo-c && mkdir build && cd build
    cmake -DCMAKE_BUILD_TYPE=Release ..
    make && sudo make install
    

    libomemo-c additionally requires libprotobuf-c (dev headers + library) to build. Either way, Telegabber's cgo bindings locate whichever one you chose via pkg-config (libomemo-c or libsignal-protocol-c, matching the build tag), so make sure that succeeds afterward - install to a prefix pkg-config already searches (the distro packages do this automatically; a manual make install defaults to /usr/local, or point PKG_CONFIG_PATH at wherever the .pc file ended up, typically <prefix>/lib/pkgconfig).

  • Install Go (tested with 1.13, but may work with earlier versions too).

  • Open the source dir in a new shell (to make sure that $GOPATH works) and run make. Dependencies will be installed automatically.

After a successful build, you get a single binary to deploy on your server.

In the deploy directory, you need only three files:

  • telegabber (the binary)
  • config.yml
  • config_schema.json (copy it from the repo)

Installation

A third-party Docker config was prepared to set up telegabber+Prosody: https://github.com/e1z0/telegabber-docker/

Hard way:

First of all, you need to create component listener on your Jabber server. For example, for ejabberd in /etc/ejabberd/ejabberd.yml:

listen:  
  -  
    port: 8888  
    module: ejabberd_service  
    access: all  
    shaper_rule: fast  
    ip: "127.0.0.1"  
    service_check_from: false  
    hosts:  
        "tlgrm.localhost":  
            password: "secret"

Next, rename config.yml.example to config.yml and edit xmpp section to match your component listener:

:xmpp:
	db 'users.db'  
	jid: 'tlgrm.localhost'  
	host: 'localhost'  
	port: 8888  
	secret: 'secret'  
	loglevel: :warn   

Configuration

It is good idea to obtain Telegram API ID from https://my.telegram.org to remove demo key requests limit, and then edit in config.yml:

:telegram:
    :tdlib:
        :client:
            :api_id: '845316' # telegram API ID (my.telegram.org) #
            :api_hash: '27fe5224bc822bf3a45e015b4f9dfdb7' # telegram API HASH (my.telegram.org) #
    ...

Arguments

  • --profiling-port=xxxx: start the pprof server on port xxxx. Access is limited to localhost.
  • --config=/bla/bla/config.yml: set the config file path (default: config.yml).
  • --schema=/bla/bla/schema.json: set the schema file path (default: ./config_schema.json).
  • --ids=/bla/bla/ids: set the folder for ids database (default: ids).

How to receive files from Telegram

First of all, you need to set up web server that will serve some directory in your filesystem. Example nginx config:

server {
	listen 80;
	server_name tlgrm.localhost;
	location /content {
		alias /var/zhabogram;
	}
}

You need to set :content: → :path: and :link: config.yml.

Set :path: according to location (for our example it will be /var/zhabogram/content).
Set :link: according to server_name (for our example it will be http://tlgrm.localhost)

How to send files to Telegram chats

You need to setup mod_http_upload for your XMPP server.
For example, for ejabberd in /etc/ejabberd/ejabberd.yml

modules:
  mod_http_upload:
    docroot: "/var/ejabberd/upload" # this must be a valid path, user ownership and SELinux flags must be set accordingly
    put_url: "https://xmpp.localhost:5443/upload/@HOST@"
    get_url: "https://xmppfiles.localhost/upload/@HOST@"
    access: local
    max_size: 500000000 #500 MByte
    thumbnail: false
    file_mode: "0644"
    dir_mode: "0744"

Then you need to setup nginx proxy that will serve get_url path, because Telegram will not handle URLs with non-default http(s) ports.
Example nginx config:

server {
	listen 80;
	listen 443 ssl;

	server_name xmppfiles.localhost;

        # SSL settigns #
        keepalive_timeout   60;
        ssl_certificate      /etc/ssl/domain.crt;
        ssl_certificate_key  /etc/ssl/domain.key;
        ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers  "RC4:HIGH:!aNULL:!MD5:!kEDH";
        add_header Strict-Transport-Security 'max-age=604800';

        location / {
            proxy_pass https://xmpp.localhost:5443;
        }	

}

Finally, update :upload: in your config.yml to match server_name in nginx config.

Carbons

Telegabber needs special privileges according to XEP-0356 to simulate message carbons from the users (to display messages they have sent earlier or via other clients). Example configuration for Prosody:

modules_enabled = {
        [...]

        "privilege";
}

[...]

Component "telegabber.yourdomain.tld"
    component_secret = "yourpassword"
    modules_enabled = {"privilege"}

[...]

VirtualHost "yourdomain.tld"
    [...]

    privileged_entities = {
        [...]

        ["telegabber.yourdomain.tld"] = {
            message = "outgoing";
        },
    }