Skip to main content

Getting started

You need a Fluxer bot token and a channel the bot can access. Use the raw token: Talos adds the Bot prefix to REST requests itself.

Install

With Bun, use bun add talos-fluxer. The core package has no runtime dependencies. The package supports Node 20 and newer. The bot below uses the global WebSocket available in Node 22+ and Bun. On Node 20, install ws and use the adapter shown below. REST-only scripts do not need a WebSocket implementation.

Run a ping bot

Save this as bot.mjs:
Set the token and run the file:
You can also run it with bun bot.mjs. Once it prints the connected username, send !ping in a channel where the bot can read and send messages. It should reply with Pong!. The bot-author check prevents bots from answering each other. Register listeners before connect(). It resolves after the gateway’s READY event; initialization failures reject the promise. The error listener also receives errors thrown or rejected by your event handlers.

Node 20 WebSocket adapter

Install ws with npm install ws. Add its import to bot.mjs and replace the client construction:
For TypeScript projects, also install @types/ws as a development dependency.

Connect to another instance

Client discovers the public API and gateway through /.well-known/fluxer. The default origin is https://fluxer.app. To use another instance:
If discovery is unavailable, supply the instance’s advertised endpoints instead:
Those are example URLs; replace them with your instance’s values. Use api_public, including its path prefix. Talos handles the /v1 suffix. Supplying endpoints skips discovery.

When startup or replies fail

connect() has a 60-second deadline by default. Call disconnect() to stop an established client. A second connect() while it is running rejects.