Start here
Build on Bafflux
Make bots that join servers, answer slash commands and post messages, using a plain HTTP API and a WebSocket.
Bafflux bots are regular accounts with a BOT tag that your own code controls. There's no SDK to install: everything is JSON over HTTPS, plus one WebSocket for live events. If your language can make HTTP requests, it can run a bot.
How it fits together
- Make an application in the Developer Portal. It comes with a bot account.
- Copy the bot's token from the portal's Bot page. Your code sends it with every request.
- Add the bot to a server with the install link on the Installation page.
- Connect to the gateway to hear about new messages, members and commands as they happen.
- Register slash commands, then answer them when people use them.
What bots can do
- Read and send messages, with mentions, replies, reactions, pins, files and threads.
- Register slash commands (
/ping,/say text: hello) that people pick from the command list, and answer them in the channel or privately ("only you can see this"). - Register prefix commands like
!help, which show up in the command list and arrive as normal messages. - Moderate with the permissions they were given: kick, ban, manage roles, manage channels.
- Set a status and custom status, and DM people they share a server with.
Two ways to receive commands
| Gateway | HTTP endpoint | |
|---|---|---|
| How | Keep a WebSocket open; commands arrive as INTERACTION_CREATE events | We POST each command to your HTTPS URL |
| Good for | Bots on a computer or server that's always on | Serverless hosts (Cloudflare Workers, Vercel, and so on) that sleep between requests |
| Messages and other events | Yes | No (commands only) |
Most bots start on the gateway. See Interactions for the HTTP option.
Where things live
| What | URL |
|---|---|
| REST API | https://bafflux.com/api |
| Gateway (WebSocket) | wss://bafflux.com/api/gateway |
| Developer Portal | https://bafflux.com/developers |
Running Bafflux yourself? The API and gateway are on the same address as the app, under
/api. With the default local setup that'shttp://localhost:3000/apiandws://localhost:3000/api/gateway.
Ready? Build your first bot.