Start

Example bots

Two small apps you can run today. Each one needs only a test or live key with the right permission. Paste your key and tokens into the lines at the top, then run.

Telegram balance bot

Send /balance to your own bot and it answers with your Adolfjon balance. It only answers your own chat, so your balance stays private.

  • Permission: balance:read
  • Create a bot with @BotFather and copy its token.
  • Find your chat id: message @userinfobot.
  • Paste the bot token, your chat id and your API key into the first lines, then run it. Node.js: save as bot.mjs (Node 18+).
import requests

TG_BOT_TOKEN = "123456789:YOUR_BOT_TOKEN"
OWNER_CHAT_ID = 123456789
KEY = "ak_test_YOUR_KEY"

TG = f"https://api.telegram.org/bot{TG_BOT_TOKEN}"
API = "https://dev.adolfjon.uz/v1"
OWNER = OWNER_CHAT_ID


def balance():
    r = requests.get(f"{API}/me/balance", headers={"Authorization": f"Bearer {KEY}"}, timeout=10).json()
    if not r["ok"]:
        return "Error: " + r["error"]["message"]
    amount = f"{r['data']['balance']:,}".replace(",", " ")
    return f"Balance: {amount} {r['data']['currency']}"


offset = 0
while True:
    ups = requests.get(f"{TG}/getUpdates", params={"offset": offset, "timeout": 50}, timeout=60).json()["result"]
    for u in ups:
        offset = u["update_id"] + 1
        msg = u.get("message") or {}
        if msg.get("chat", {}).get("id") != OWNER:
            continue
        if msg.get("text") == "/balance":
            requests.post(f"{TG}/sendMessage", json={"chat_id": OWNER, "text": balance()}, timeout=10)

Discord order notifier

Posts every new order on your account to a Discord channel. It checks once a minute, well under the rate limit, and remembers what it already posted in seen_orders.json.

  • Permission: orders:read
  • In Discord: channel settings → Integrations → Webhooks → New webhook → copy the URL.
  • Paste the Discord webhook URL and your API key into the first lines, then run it. Node.js: save as notify.mjs.
  • The first run only remembers your existing orders; new ones get posted from then on.
import json, os, time, requests

KEY = "ak_test_YOUR_KEY"
HOOK = "https://discord.com/api/webhooks/YOUR_WEBHOOK"

API = "https://dev.adolfjon.uz/v1"
SEEN_FILE = "seen_orders.json"

seen = set(json.load(open(SEEN_FILE))) if os.path.exists(SEEN_FILE) else None

while True:
    r = requests.get(f"{API}/me/orders", params={"limit": 20},
                     headers={"Authorization": f"Bearer {KEY}"}, timeout=10).json()
    if r["ok"]:
        if seen is None:
            seen = {o["id"] for o in r["data"]}
        for o in reversed(r["data"]):
            if o["id"] in seen:
                continue
            seen.add(o["id"])
            items = ", ".join(i["title"] for i in o["items"])
            total = f"{o['total_uzs']:,}".replace(",", " ")
            requests.post(HOOK, json={"content": f"New order {o['id']}: {items} · {total} UZS · {o['status']}"}, timeout=10)
        json.dump(sorted(seen), open(SEEN_FILE, "w"))
    time.sleep(60)

Tips

  • Start with an ak_test_ key: account endpoints return realistic fake data, so you can build without touching your real account.
  • A file with your key inside is like a password: do not send it, upload it to GitHub or show it in a screenshot. See Key safety.
  • Running it on a server? Lock the key to that server's IP. See IP allowlist.