Build bots and automations for your Enclave server.
Go to Server Settings → Manage Bots → Create Bot. Give it a name.
The bot token is shown once on creation. Copy it and store it securely. You can regenerate it later if needed.
Use any language that supports HTTP requests and/or WebSockets. The examples below use Python, but the API works with Node.js, Go, Rust, or anything else.
All bot API requests use the Authorization header with the Bot prefix:
Authorization: Bot your-bot-token-here
POST /api/bots/send
Send a message to a channel as your bot.
| Field | Type | Description |
|---|---|---|
channelId required |
string | The channel to send the message to. Must be in the bot's server. |
content required |
string | Message content (1-4000 characters). Supports Markdown. |
replyToId optional |
string | ID of a message to reply to. |
import requests
TOKEN = "your-bot-token"
API = "https://enclaveapp.online/api"
requests.post(f"{API}/bots/send", json={
"channelId": "channel-uuid-here",
"content": "Hello from my bot! 🤖"
}, headers={"Authorization": f"Bot {TOKEN}"})
These endpoints are for managing bots via the API. They require admin permissions (use your user JWT, not the bot token).
POST /api/bots/:serverId
| Field | Type | Description |
|---|---|---|
name required | string | Bot display name (1-32 chars) |
avatar optional | string | Avatar URL |
Returns the bot object and its token. The token is only shown once.
GET /api/bots/:serverId
Returns all bots for the server. Tokens are not included.
PATCH /api/bots/:serverId/:botId
| Field | Type | Description |
|---|---|---|
name optional | string | New display name |
avatar optional | string | null | New avatar URL or null to remove |
enabled optional | boolean | Enable or disable the bot |
DELETE /api/bots/:serverId/:botId
POST /api/bots/:serverId/:botId/regenerate
Generates a new token. The old token stops working immediately.
Bots can connect to Socket.IO to receive real-time events like new messages, reactions, and member changes.
import socketio
sio = socketio.Client()
sio.connect("https://enclaveapp.online", auth={
"botToken": "your-bot-token"
})
On connection, the bot automatically joins all channel rooms in its server and starts receiving events.
You can also send messages and reactions through the socket connection:
# Send a message
sio.emit("bot-send-message", {
"channelId": "channel-uuid",
"content": "Hello!"
})
# Add a reaction
sio.emit("bot-add-reaction", {
"messageId": "message-uuid",
"emoji": "👍"
})
Events your bot receives when connected via Socket.IO:
| Event | Data | Description |
|---|---|---|
new-message | Message | A new message was sent in a channel |
message-edited | Message | A message was edited |
message-deleted | { messageId } | A message was deleted |
message-reactions-updated | { messageId, reactions[] } | Reactions on a message changed |
member-joined | { serverId, member } | A new member joined the server |
member-left | { serverId, userId } | A member left or was removed |
server-updated | Server | Server settings were changed |
{
"id": "uuid",
"content": "Hello world",
"channelId": "uuid",
"userId": "uuid",
"botId": "uuid" | null,
"user": { "id", "username", "avatar" },
"bot": { "id", "name", "avatar" } | null,
"createdAt": "ISO 8601",
"replyToId": "uuid" | null,
"reactions": []
}
A simple bot that responds to !ping with Pong! and !time with the current time:
import requests
import socketio
from datetime import datetime
TOKEN = "your-bot-token"
API = "https://enclaveapp.online/api"
HEADERS = {"Authorization": f"Bot {TOKEN}"}
sio = socketio.Client()
@sio.event
def connect():
print("Bot connected!")
@sio.on("new-message")
def on_message(data):
# Ignore messages from this bot
if data.get("botId"):
return
content = data["content"]
channel = data["channelId"]
if content == "!ping":
requests.post(f"{API}/bots/send", json={
"channelId": channel,
"content": "Pong! 🏓",
"replyToId": data["id"]
}, headers=HEADERS)
elif content == "!time":
now = datetime.now().strftime("%H:%M:%S")
requests.post(f"{API}/bots/send", json={
"channelId": channel,
"content": f"The time is **{now}** ⏰"
}, headers=HEADERS)
sio.connect("https://enclaveapp.online", auth={
"botToken": TOKEN
})
sio.wait()
pip install requests python-socketio[client] websocket-client
Bots have the following limitations:
| Limit | Value |
|---|---|
| Max bots per server | 25 |
| Message content length | 4,000 characters |
| Bot name length | 1-32 characters |
Bots cannot: