Bots
Your own helpers for your server: they react to commands and messages.
Developers
The full documentation for anyone who wants to build their own helpers: webhooks, bots, gateway, slash commands and the Node.js SDK.
Your own helpers for your server: they react to commands and messages.
Let other services post messages into your channels.
Type “/” in chat and trigger something quickly.
In the examples, <your-lobus-address> stands for the address of your Lobus instance. Replace it with your real address.
Lobus offers two ways to automate things. There is also a small bot SDK for Node.js.
| Way | What for | Sign-in |
|---|---|---|
| Webhooks | Simply post messages into a channel (build status, alerts, feeds) | Secret URL, no account needed |
| Bots | React to messages, offer slash commands, moderate | Bot token (lobus_bot_…) |
https://<your-lobus-address>/api/v1/hooks/<webhook-id>/<secret-part>. Treat it like a password.curl -X POST "https://<your-lobus-address>/api/v1/hooks/<webhook-id>/<secret-part>" \
-H "content-type: application/json" \
-d '{"content":"Build #42 passed ✅"}'
Response on success: 204 No Content.
content (text, up to 4000 characters) and optionally embeds (up to 10).429 with a wait time).Embeds contain text only and are allowed for bots and webhooks. No external images or links.
{
"content": "",
"embeds": [
{
"title": "Deployment",
"description": "Version 1.4.2 is live.",
"color": "#7c5cff",
"fields": [
{ "name": "Duration", "value": "42 s", "inline": true },
{ "name": "Branch", "value": "main", "inline": true }
],
"footer": "CI"
}
]
}
Limits: at most 3 embeds per bot message, title 256 characters, description 2000, up to 10 fields, footer 128, 4000 characters in total.
lobus_bot_…) is shown only once. The server stores only a SHA-256 hash. If you lose it: “New token”.Bots are normal members with a managed role. They only see channels their role allows, and are authorized and rate-limited like users. Resetting, deleting and adding a token is recorded in the log.
Every request carries the header Authorization: Bot <token>.
Bots may: read servers, read, send, edit and delete channel messages, add reactions, send files, fetch a gateway ticket, remove, ban and time out members, assign roles and register their own slash commands. Everything else (friends, direct messages, profile, dev portal, server administration) is reserved for people.
POST /api/v1/channels/:channelId/messages
{ "content": "…", "embeds": [ … ] }
POST /api/v1/gateway/ticket (valid for 30 seconds, single use).wss://<your-lobus-address>/gateway?ticket=<ticket>.{ "t": "<type>", "d": { … } }. Important types: ready, message.create, message.update, message.delete, interaction.create, presence.update.POST /api/v1/gateway/ticket
wss://<your-lobus-address>/gateway?ticket=<ticket>
{ "t": "message.create", "d": { … } }
The SDK takes care of the ticket, the connection and automatic reconnecting with a back-off.
PUT /api/v1/bot/commands (replaces all previous ones, at most 50). Names: a-z, 0-9, _, -. Options have the type string, integer or boolean./ and see suggestions, then /command value ….interaction.create on the gateway with a one-time token.POST /api/v1/interactions/:id/:token/callback with { "content": "…", "embeds": [ … ] }. Valid for 15 minutes, at most 5 replies. No bot header is needed for this, only the token from the event.[
{
"name": "wuerfeln",
"description": "Rolls a number",
"options": [
{ "name": "seiten", "description": "Number of sides", "type": "integer", "required": true }
]
}
]
POST /api/v1/interactions/:id/:token/callback
{ "content": "…", "embeds": [ … ] }
No dependencies, Node 22 or newer (built-in fetch and WebSocket). The SDK lives in the Lobus project under packages/bot-sdk. It is not published as a package yet.
import { Bot } from './packages/bot-sdk/src/index.ts';
const bot = new Bot({
baseUrl: process.env.LOBUS_URL ?? '',
token: process.env.LOBUS_BOT_TOKEN ?? '',
});
bot.on('ready', async () => {
await bot.rest.setCommands([
{
name: 'wuerfeln',
description: 'Rolls a number',
options: [{ name: 'seiten', description: 'Number of sides', type: 'integer', required: true }],
},
]);
});
bot.on('interaction.create', async (i) => {
if (i.command !== 'wuerfeln') return;
const seiten = Math.min(Math.max(Number(i.options.seiten) || 6, 2), 1000);
const wurf = 1 + Math.floor(Math.random() * seiten);
await bot.rest.respond(i, '', [
{ title: 'Roll', description: `${i.user.displayName} rolls a ${wurf} (W${seiten})`, color: '#7c5cff' },
]);
});
await bot.start();
Start:
LOBUS_URL=https://<your-lobus-address> LOBUS_BOT_TOKEN=lobus_bot_… node bot.ts
The SDK sends the token only to the address you give it, keeps it in memory only, and catches errors in individual handlers without stopping the bot.
Errors come as JSON { "error": "<code>" } with a matching HTTP status:
| Status | Meaning |
|---|---|
400 | invalid input |
401 | not signed in |
403 | no permission |
404 | not found (also when you are not allowed to see it) |
409 | conflict (e.g. webhook limit) |
429 | too many requests |