Short invite link service & custom username bot for Delta Chat
  • Python 98.4%
  • Shell 1.4%
  • Dockerfile 0.2%
Find a file
Gluek 73f74b9d10
Remove bot-side relay failover, deprecate /setprimary and /resilient
Since core 2.61 the SMTP relay is no longer chosen via configured_addr:
the core tries the newest relay first and falls back to the next one if
a relay is unreachable. The MSG_FAILED failover handler and resilient
send patch switched configured_addr and resent, which no longer changes
the relay and only produced delayed duplicate resends.

- remove on_msg_failed failover and _setup_resilient_mode
- /setprimary and /resilient reply with a deprecation note
- /transports lists relays in the core's sending order
- require deltachat-rpc-server>=2.62.0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 17:28:36 +02:00
.github/workflows ci: restrict changelog notification trigger to main and master branches 2026-09-16 13:18:33 +01:00
tests Remove bot-side relay failover, deprecate /setprimary and /resilient 2026-09-28 17:28:36 +02:00
web refactor: extract web/routes.py (FastAPI app and HTTP endpoints) 2026-09-20 22:03:59 +01:00
.dockerignore feat: initial release of Delta Chat Username Bot (v1.0.0) 2026-07-24 23:49:54 +03:00
.env.example config: set default INVITE_BASE_URL to i.deltachat.id 2026-08-22 00:55:18 +03:00
.gitignore feat: initial release of Delta Chat Username Bot (v1.0.0) 2026-07-24 23:49:54 +03:00
bot.py Remove bot-side relay failover, deprecate /setprimary and /resilient 2026-09-28 17:28:36 +02:00
Caddyfile feat: default to deltachat.id with dynamic multi-domain support (v1.6.0) 2026-08-22 00:52:46 +03:00
CHANGELOG.md Remove bot-side relay failover, deprecate /setprimary and /resilient 2026-09-28 17:28:36 +02:00
commands.py Remove bot-side relay failover, deprecate /setprimary and /resilient 2026-09-28 17:28:36 +02:00
database.py release: v1.8.3 security, database WAL & transport command hardening 2026-09-09 21:53:54 +01:00
dc_helpers.py v1.9.0: /cmd@bot suffixes in groups; answer plain /help privately 2026-09-24 17:02:03 +02:00
docker-compose.yml config: set default INVITE_BASE_URL to i.deltachat.id 2026-08-22 00:55:18 +03:00
Dockerfile fix: add font packages to Dockerfile and configure font directories in resvg (v1.5.2) 2026-08-21 23:26:32 +03:00
favicon.ico v1.4.2: update avatar icon.jpg/icon.png and generate multi-resolution favicon.ico 2026-07-26 23:49:33 +03:00
formatting.py refactor: extract formatting.py (URL/text/QR helpers) 2026-09-20 22:00:48 +01:00
icon.jpg v1.4.2: update avatar icon.jpg/icon.png and generate multi-resolution favicon.ico 2026-07-26 23:49:33 +03:00
icon.png v1.4.2: update avatar icon.jpg/icon.png and generate multi-resolution favicon.ico 2026-07-26 23:49:33 +03:00
identicon.py feat: send lightweight WebP card attachment with direct invite link in /username (v1.8.0) 2026-08-22 12:33:00 +03:00
README.md Remove bot-side relay failover, deprecate /setprimary and /resilient 2026-09-28 17:28:36 +02:00
requirements.txt Remove bot-side relay failover, deprecate /setprimary and /resilient 2026-09-28 17:28:36 +02:00
security.py fix: trust the right end of X-Forwarded-For, prune stale rate-limit entries, drop dead crawler-detection code 2026-09-20 22:26:22 +01:00
set_admin.py feat: initial release of Delta Chat Username Bot (v1.0.0) 2026-07-24 23:49:54 +03:00
update.sh v1.8.6: fix update.sh deploying a PR branch instead of main/master 2026-09-24 16:48:50 +02:00

🔗 Delta Chat Username & Short Link Bot (deltachat_username)

A Delta Chat bot and FastAPI web service for registering custom usernames and generating short invite links (https://deltachat.id/<username>) that redirect (via HTTP 307 Temporary Redirect) to standard Delta Chat invite URLs (https://i.delta.chat/#...).


✨ Features

  • 👤 Custom Usernames: Claim a short username (/username myname) for your personal profile or group chat.
  • 🔐 Visual Cryptographic Verification: Anti-impersonation verification displaying 10-group formatted PGP fingerprints, 5x5 symmetric Unicode block Identicons, and 5-emoji visual badges.
  • 🖼️ Social OpenGraph & Twitter Cards: Smart crawler detection serving rich metadata and cached dynamic PNG cards (1200x630) on Telegram, Discord, Twitter, WhatsApp, etc.
  • 📇 Web Profile Cards & Avatars: Dynamic endpoints (/{username}/og.png, /{username}/avatar.svg, and /{username}/card) for visual badges, QR codes, and web verification.
  • ⚡️ Group Chat Auto-Binding: Use /username myname directly inside any group chat — the bot instantly generates the group's invite URL without manual link pasting.
  • 🔀 HTTP 307 Temporary Redirect: Guarantees browsers and proxies always fetch the newest invite link without aggressive caching.
  • 🌐 Web Landing Page: Beautiful dark-mode glassmorphism interface on GET / displaying bot description, QR code, and interactive command hints.
  • 🛡️ Secure Administration: Authenticate ownership via /initadmin with cryptographic fingerprint verification.
  • 📡 Multi-Transport & Statistics: Track sent/received relay stats and configure backup transports.

🚀 Quick Start & Deployment

1. Build Container

Clone repository and navigate to deltachat_username:

cd deltachat_username
cp .env.example .env
docker compose build

2. Initialize Delta Chat Account

Initialize the bot's account in Delta Chat CLI (deltabot-cli):

# Option A: Automatic setup on a Chatmail server (e.g. chatmail.uk or nine.testrun.org)
docker compose run --rm username_bot python bot.py init usernamebot@chatmail.uk

# Option B: Standard email account with password
docker compose run --rm username_bot python bot.py init usernamebot@yourdomain.com "your_password"

3. (Optional) Pre-configure Admin Email / Fingerprint

docker compose run --rm username_bot python set_admin.py --email admin@yourdomain.com

4. Launch Bot Daemon

docker compose up -d

5. Claim Administrative Ownership

Send /initadmin to the bot in a private message in Delta Chat to complete admin identity verification.


🤖 Bot Commands

Command Scope Description
/username All Check your current chat's registered username and short link.
/username <name> All Look up short link for any registered username.
/link <name> <url> Private Bind custom username & invite link (replaces old username if present).
/link <name> Group Auto-generate group invite link and bind username.
/unlink All Unlink registered username from current chat.
/unlink <name> Admin Force-unlink a registered username.
/help All Show command help and bot info.
/donate All Support bot development.
/initadmin Admin Claim administrative ownership.
/url <url> Admin Set base domain URL (https://deltachat.id).
/inviteurl <url> Admin Set custom invite base URL/mirror (https://i.gluek.info/#).
/stats Admin Show registered usernames and database stats.
/transports Admin List configured mail relays and statistics.
/addtransport <uri/creds> Admin (Private) Add a backup mail transport relay.
/rmtransport <addr> Admin Remove a configured mail transport.

Relay selection and failover are handled by the Delta Chat core (2.61+): it sends via the newest relay first and falls back to the next one if a relay is unreachable. /transports lists relays in that order. The former /setprimary and /resilient commands are deprecated and only reply with this explanation.


Target-Specific Commands in Group Chats

In group chats where multiple bots are present, you can address this bot specifically to prevent other bots from responding. Append the @username (or @user, @usernamebot) suffix to any command, for example:

  • /help@username
  • /stats@username

A plain /help sent in a group chat is answered in a private 1:1 chat with the sender, so several bots don't flood the group with help texts. Use /help@username to show the help in the group itself.

🌐 Caddy Configuration

Add to your /etc/caddy/Caddyfile:

deltachat.id, d.gluek.info {
    reverse_proxy 127.0.0.1:8080
}

www.deltachat.id {
    redir https://deltachat.id{uri} permanent
}

🧪 Running Unit Tests

python3 -m unittest discover -s tests -p "test_*.py" -v

❤️ Support & Development

If you find this bot useful, consider supporting its development: