Bafflux Docs Developer Portal

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

  1. Make an application in the Developer Portal. It comes with a bot account.
  2. Copy the bot's token from the portal's Bot page. Your code sends it with every request.
  3. Add the bot to a server with the install link on the Installation page.
  4. Connect to the gateway to hear about new messages, members and commands as they happen.
  5. 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

GatewayHTTP endpoint
HowKeep a WebSocket open; commands arrive as INTERACTION_CREATE eventsWe POST each command to your HTTPS URL
Good forBots on a computer or server that's always onServerless hosts (Cloudflare Workers, Vercel, and so on) that sleep between requests
Messages and other eventsYesNo (commands only)

Most bots start on the gateway. See Interactions for the HTTP option.

Where things live

WhatURL
REST APIhttps://bafflux.com/api
Gateway (WebSocket)wss://bafflux.com/api/gateway
Developer Portalhttps://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's http://localhost:3000/api and ws://localhost:3000/api/gateway.

Ready? Build your first bot.