FNLB Devs

Developer Portal

SDK

SDK Overview

The fnlb package is the self-hosted client. start() downloads the FNLB client, forks one process per shard, and logs those bots into Fortnite. Events, party meta, chat, and bot.runCommand talk to those processes over local IPC. fnlb.api is a separate HTTP client for the same account, including bots that are not running in this process. Install, tokens, shards, and shutdown stay on the Node.js SDK page. Every class and method is also in the SDK Reference. The machine-readable spec is /sdk.json. Generated Markdown for one symbol is under /sdk-reference, for example Party.

What you import

import FNLB, {
  Events,
  PartyPrivacy,
  Playlist,
  PresenceOnlineType,
  ApiError,
  SDK_BRIDGE_UNAVAILABLE
} from 'fnlb';
ExportUse it for
FNLBThe client. start(), stop(), on, bots, api. Reference: FNLB.
EventsListener names. Reference: Events.
PartyPrivacyparty.setPrivacy. Reference: PartyPrivacy.
PlaylistBuilt-in playlist link ids for party.setPlaylist. Reference: Playlist.
PresenceOnlineTypebot.setStatus. Reference: PresenceOnlineType.
ApiErrorNon-2xx responses from fnlb.api. Reference: ApiError.
SDK_BRIDGE_UNAVAILABLEThrown when a shard never opens the local bridge.

Bot, Party, PartyMember, PartyMeta, Message, and Collection are also exported if you want the types. You normally receive them from fnlb.on and fnlb.bots.

Two ways to talk to a bot

Local shardHTTP API
WhenThe bot is running in this processAny bot on the account, online or not
Entryfnlb.bots, bot.party, fnlb.onfnlb.api after start()
Party metabot.party.meta and bot.party.me.metaNot available. The API member route is a cosmetic snapshot.
Commandsbot.runCommandfnlb.api.bots.commands.run
Chatbot.send, bot.whisper, message.replyfnlb.api.bots.chat.send
Friendsbot.friends(), addFriend, blockapi.bots.friends.list reads a connected bot. It does not add or block.
Cosmeticsparty.setOutfit and the other member methodsA command through commands.run, or a category config outfit list

Guides

  • Events

    Ready, chat, friends, invites, joins, and cosmetic changes.

  • Bots and parties

    Members, meta, privacy, playlists, and cosmetics.

  • Chat and commands

    Party chat, whispers, friend requests, and local commands.

  • HTTP client

    List bots, categories, presets, and run cloud commands.

  • Category config

    Keys for overrideCategoryConfig and selection overrides.

  • Node.js SDK

    Install, authenticate, shard, and stop the process.

  • SDK Reference

    Generated classes, methods, and types.

A complete loop

import FNLB, { Events, PartyPrivacy, Playlist } from 'fnlb';

const fnlb = new FNLB({ clusterName: 'dev' });

fnlb.on(Events.Ready, (bot) => {
  console.log(bot.displayName, 'is ready');
});

fnlb.on(Events.PartyMemberMessage, async (message) => {
  if (message.content === '!ping') await message.reply('pong');
});

await fnlb.start({
  token: 'FNLB_...',
  categories: ['your-category-id']
});

const bot = await fnlb.bots.fetch('bot-id');
await bot.party.setPrivacy(PartyPrivacy.PRIVATE);
await bot.party.setPlaylist(Playlist.SQUAD);
await bot.party.setOutfit('CID_028_Athena_Commando_F');
await bot.party.meta.set('Default:CustomMatchKey_s', 'my-key');

const accountBots = await fnlb.api.bots.list();

fnlb.bots.cache only contains bots this process has started. fnlb.api.bots.list() is every bot on the token.

Shards

Each shard is a child process. fnlb.shards holds them after start(). fnlb.fetchShardInfo() returns version, protocol, gateway connection, and bot count for each one. fnlb.broadcast(method, params) sends one bridge call to every shard and returns a result per shard. A failed shard is ok: false and does not reject the whole call. Prefer fnlb.bots for party, chat, and commands. Use the shard when you want Shard.fetchInfo.

When a call throws

ErrorCause
SDK_BRIDGE_UNAVAILABLEThe shard never announced the bridge. The downloaded FNLB client is too old, or it exited before hello.
Bot <id> is not running on this client.fetch was asked for a bot this process did not start. Use fnlb.api.bots.get for account bots.
Only this bot can change its own member.party.members.get(someoneElse).setOutfit (or any other self-only member method).
Party leader errors from FortnitesetPrivacy, kick, setPlaylist, and the other leader calls when this bot is not the leader.
ApiErrorfnlb.api got a non-2xx response. status, path, and body are on the error.

Local party calls need a current FNLB client. An older build rejects fortnite.action with an unknown-method error. fnlb.api still works on that build.

Where to go next

You want toRead
Hear ready, chat, invites, and cosmetic changesEvents
Change privacy, playlist, meta, or cosmeticsBots and parties
Chat, friends, and runCommandChat and commands
Create bots, categories, or run a cloud commandHTTP client
Override dashboard settings for this runCategory config
Install, tokens, and shard countsNode.js SDK