🤖

Prizrak Bot API

Write bots just like for Telegram: three HTTP methods, a familiar response format, long-poll. Except here the bot is a full E2E participant in a free federation.

Everything below is shown on the example server prizrak.im — but the Bot API is built into every Prizrak homeserver. Deployed your own server? Everything works exactly the same: the same PrizrakFather, the same methods — only the address is yours: http://your-domain:8840 (or your own nice subdomain, like api.prizrak.im).
Quick start

A bot in three steps

  1. Message PrizrakFather

    In the Prizrak app, open a chat with prizrakfather:prizrak.im (on your own server — prizrakfather:your-domain) and send /newbot. It asks for a name and a login — and issues a token.

  2. Check the token

    One request — and the bot replies:

    curl https://api.prizrak.im/bot<TOKEN>/getMe
    # {"ok":true,"result":{"id":7,"is_bot":true,"username":"my_bot",…}}
  3. Done

    The bot can message people, post to groups and channels and receive incoming messages. Keep the token like a password; to reissue it — the /revoke command in PrizrakFather.

Format

Requests and responses — just like Telegram

All methods: https://api.prizrak.im/bot<TOKEN>/MethodName (GET or POST, parameters as a query string or a JSON body). The response is always a JSON envelope:

{"ok": true,  "result": …}
{"ok": false, "error_code": 401, "description": "invalid bot token"}
Methods

Just three — you don't need more

👤

getMe

Information about the bot. No parameters. Handy for checking the token.

✉️

sendMessage

Send text — to a person, a group or a channel.

ParameterDescription
chat_idnick:domain — a private message; !room-id… — a group or channel (the bot must be added as a member).
textMessage text.
curl -X POST https://api.prizrak.im/bot<TOKEN>/sendMessage \
  -d '{"chat_id":"!f752e422c5088e96:prizrak.im","text":"News of the day! 🚀"}'

This is how any site, script or CRON job publishes posts to a Prizrak channel over HTTP. Add the bot to a room (PrizrakFather gave you its ID) — and post from anywhere.

📥

getUpdates

Receiving incoming messages (long-poll).

ParameterDescription
offsetAcknowledgement: updates with an update_id lower than offset are removed from the server.
limit1–100 (default 100).
timeoutLong-poll in seconds, 0–30. With 0 — an immediate response.
curl "https://api.prizrak.im/bot<TOKEN>/getUpdates?timeout=25&offset=0"
# {"ok":true,"result":[{"update_id":1,"message":{
#   "message_id":"…","text":"hi, bot",
#   "from":{"id":"fox:prizrak.im","username":"fox","is_bot":false},
#   "chat":{"id":"fox:prizrak.im","type":"private"},"date":1766400000}}]}
Example

An echo bot in 10 lines

// Node.js ≥ 18, no dependencies
const API = 'https://api.prizrak.im/bot' + process.env.TOKEN;
let offset = 0;
while (true) {
  const { result } = await (await fetch(`${API}/getUpdates?timeout=25&offset=${offset}`)).json();
  for (const u of result) {
    offset = u.update_id + 1;
    if (u.message?.text) await fetch(`${API}/sendMessage`, { method: 'POST',
      body: JSON.stringify({ chat_id: u.message.chat.id, text: 'Echo: ' + u.message.text }) });
  }
}
PrizrakFather

Managing bots — right in a chat

The service bot prizrakfather:prizrak.im lives on every federation server and is created automatically.

/newbot

Create a bot: it asks for a name and a login, issues a token (shown once).

📋

/mybots

A list of your bots.

🔑

/revoke <login>

Reissue the token — the old one is revoked instantly.

🗑

/deletebot <login>

Delete the bot and its message queue.

Security

Honestly about how it works

🔐

E2E just like for people

A bot is an ordinary Prizrak account: your chat with it is end-to-end encrypted, over the same transport.

🏠

Keys — on the home server

So the bot can work with a simple HTTP token, its keys are kept by its homeserver (as with Telegram bots). For ultra-private scenarios, use a regular account.

Token leaked? Immediately /revoke with PrizrakFather — the old token stops working the same second.

Your own server — your own bots

The Bot API is included in every Prizrak homeserver and starts automatically. Bring up a server — and your PrizrakFather is already waiting for the /newbot command.

Planned: webhooks, file sending, keyboard buttons. Existing methods won't change.