# I Built an Open-Source Telegram Bot for the OpenAI Codex Referral Promo

> Source: <https://dev.to/aaamosh/i-built-an-open-source-telegram-bot-for-the-openai-codex-referral-promo-53lm>
> Published: 2026-06-17 22:07:32+00:00

OpenAI dropped Codex referral links on June 12. Seven days of free Codex Pro for you, seven days for a friend. The catch? Each referral code can only be used once. Post your link on social media and the first person to click it claims it — everyone else gets "this referral has already been used." One shot, gone.

That's a poor user experience. And it's wasteful: every unused referral is a missed opportunity for someone who actually wants to try Codex.

So I built **@codexHuddbot** — a Telegram bot that solves the one-shot matching problem.

A user sends their Codex referral link to the bot. The bot stores it in a queue. When another user asks for a referral, the bot dequeues the oldest link, marks it as claimed, and sends it privately. No public link dumps. No race conditions. No wasted referrals. One-to-one matching, on demand.

The bot handles duplicates (you can't submit the same link twice), tracks which links have been consumed, and provides a `/status`

command.

I wanted something that could ship in an afternoon and run reliably for the two-week promo window.

`pip install aiohttp`

and `systemctl start codex-buddy`

. This is the live, running component.`wham/rate-limit-reset-credits/consume`

endpoint. For Linux and headless users who never see the in-editor popup — they'd otherwise leave those credits unused.~500 lines of application code. Two repos, MIT-licensed.

The promo ends June 24. After that, the bot's core function retires. But the architecture — a lightweight Python aiohttp server behind nginx, backed by SQLite — is reusable for any time-limited Telegram bot. The code is clean enough to serve as a reference, and the referral-matching logic is a simple queue pattern you can adapt.

Both MIT-licensed. Stars, issues, and PRs welcome. The promo ends June 24 — if you've got an unused referral link, now's the time to share it.
