Real-time bridges
Connect an application (Minecraft, FiveM, Garry's Mod, or your own) to a Discord channel: settings, bridge API protocol, console commands, account linking.
On this page
Creating a bridge Bridge settings The bridge API Heartbeat and statusGame → Discord: POST /bridge/eventsDiscord → application: GET /bridge/poll Console commands Account linking Discord commands Writing your own clientA bridge connects an external application and a Discord channel, both ways: chat, game events (join, death, advancement…), a live-updated status message, console commands sent from Discord and player ⇄ Discord account linking.
For a Minecraft server you have nothing to program: follow the Minecraft step by step guide with the RobertLink plugin. This page describes the bridge itself, useful for another game or a custom application.
Discord ⇄ Robert (bot + API) ⇄ your application
chat channel bridge "Survival" RobertLink plugin, your code…
The bot never talks to your application: everything goes through Robert's API, which keeps an event queue per bridge. Your application therefore only needs outgoing HTTPS access, no port to open.
Creating a bridge
A Premium plan or higher is required (1 bridge(s) on Premium, 5 on Pro, 25 on Network). Two ways:
- Dashboard: the server's Developers page → Bridges → Create a bridge. The wizard asks for the type, the channel and the options, then shows the
rbb_…token (only once) and offers a pre-filledconfig.ymlfor the Minecraft plugin. - API:
POST /bridgeswith a key that has thebridgesscope (see the reference).
A channel can only belong to one bridge. The token gives access to that bridge only; regenerate it at any time (POST /bridges/{id}/token): the old one stops working.
Bridge settings
| Setting | Default | Description |
|---|---|---|
name |
— | Bridge name (60 characters at most), used by /bridge |
type |
— | minecraft, fivem, gmod or generic |
chat_channel_id |
— | Linked chat channel |
status_channel_id |
none | Channel where Robert keeps a status embed up to date ("Online · 12/50 players") |
enabled |
true |
Pauses the bridge without deleting it |
settings.discord_to_game |
true |
Relay channel messages to the game |
settings.game_to_discord |
true |
Relay game chat to the channel |
settings.events |
all true |
Game events shown in Discord: join, leave, death, advancement, server_start, server_stop |
settings.discord_format |
[Discord] {name}: {message} |
Format sent to the game. Variables: {name}, {message}, {role}, {id}; {message} is mandatory |
settings.display |
webhook |
webhook: the message appears under the player's name and avatar; bot: bot message (**Steve**: text) |
settings.avatar_url |
Minecraft head | https:// avatar template, variables {uuid} and {name} (Minecraft: https://mc-heads.net/avatar/{uuid}) |
settings.mask_links |
false |
Masks links coming from Discord |
settings.status_topic |
false |
Also writes "🟢 12/50 players" in the channel topic (at most every 10 min) |
settings.console |
disabled | enabled, role_ids (allowed roles), whitelist (50 entries at most) |
settings.link |
enabled | enabled, role_id ("linked player" role), nickname_format ({name} ({player})) |
settings.group_sync |
empty | { "Discord role ID": "in-game group" } |
Robert also applies to everything coming from the game: neutralization of @everyone, @here, role and member mentions, removal of Minecraft formatting codes (§), a 1,900-character limit, the server's auto-moderation banned words, and your plan's per-bridge rate.
The bridge API
Address: https://robert-bot.com/api/v1/bridge. Authentication: Authorization: Bearer rbb_…. These routes use neither an API key nor scopes.
| Method | Path | Role |
|---|---|---|
| GET | /bridge |
Bridge info and useful settings (formats, limits) |
| POST | /bridge/events |
Send a batch of events (50 at most) to Discord |
| GET | /bridge/poll |
Read events coming from Discord (long-polling) |
| GET | /bridge/stream |
The same as Server-Sent Events |
| POST | /bridge/heartbeat |
Heartbeat every 30 seconds: players, version, TPS |
| GET | /bridge/links |
Accounts linked to this bridge (external_id, user_id) |
export BRIDGE="https://robert-bot.com/api/v1/bridge"
export TOKEN="rbb_YOUR_TOKEN"
curl -s -H "Authorization: Bearer $TOKEN" "$BRIDGE"
{
"id": "b_9f2c41d07a1b",
"name": "Survival",
"type": "minecraft",
"guild_id": "987654321098765432",
"settings": { "discord_to_game": true, "game_to_discord": true, "display": "webhook" },
"limits": { "messages_per_minute": 30, "batch": 50, "text": 1900 },
"heartbeat_seconds": 30,
"offline_after_seconds": 90,
"server_time": 1791370000
}
Heartbeat and status
Send POST /bridge/heartbeat every 30 seconds. With no heartbeat for 90 seconds, the bridge is shown as "offline".
curl -s -X POST "$BRIDGE/heartbeat" -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"online": 2, "max": 50, "players": [{"uuid": "069a79f4-44e9-4726-a5be-fca90e38aaf5", "name": "Steve"}], "version": "Paper 1.21.1", "tps": 19.9}'
Game → Discord: POST /bridge/events
curl -s -X POST "$BRIDGE/events" -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"events": [
{"type": "chat", "player": {"uuid": "069a79f4-44e9-4726-a5be-fca90e38aaf5", "name": "Steve"}, "message": "Hi!"},
{"type": "death", "player": {"uuid": "069a79f4-44e9-4726-a5be-fca90e38aaf5", "name": "Steve"}, "message": "Steve fell from a high place"}
]}'
{ "accepted": 2, "dropped": [], "rejected": [] }
| Type | Fields | Display in Discord |
|---|---|---|
chat |
player, message |
Message (under the player's name in webhook mode) |
join · leave |
player |
Small join / leave embed |
death |
player, message |
Death embed |
advancement |
player, message |
Advancement embed |
server_start · server_stop |
— | Start / stop embed |
status |
online, max |
Updates the status |
command_result |
id, ok, output |
Sends a console command's output back to Discord |
link_confirm |
code, player |
Validates an account link |
player = {"uuid": "…", "name": "…"}. ts (Unix seconds) is optional.
The response details what did not go through:
| Field | Content |
|---|---|
accepted |
Number of events taken into account |
dropped |
[{"index", "reason"}] with reason: disabled (direction or event disabled), empty (empty message after cleaning), filtered (banned word), rate_limited (plan rate exceeded) |
rejected |
[{"index", "error"}]: invalid event (unknown_type…) |
An event dropped for rate is lost, never queued on Robert's side: smooth it out yourself. More than 50 events: 422 batch_too_large. The rate (30, 120 or 300 messages per minute per bridge depending on the plan) is announced in the X-RateLimit-* headers.
Discord → application: GET /bridge/poll
curl -s -H "Authorization: Bearer $TOKEN" "$BRIDGE/poll?wait=25"
{
"events": [
{ "id": "e_3b7f", "type": "chat", "ts": 1791370000,
"author": { "id": "400000000000000001", "name": "Jimmy", "color": "#0055A4", "roles": ["Moderation"] },
"message": "Hello miners", "text": "[Discord] Jimmy: Hello miners" },
{ "id": "e_3b80", "type": "command", "ts": 1791370004, "command_id": "cmd_7a2e91",
"command": "whitelist add Steve", "by": { "id": "111111111111111111", "name": "Hugo" } }
],
"cursor": "djE6OTEy"
}
Resume with ?cursor=<cursor>: without a cursor you only get the last 60 seconds. Events stay available for 10 minutes in the bridge's queue. wait: 0 to 25 seconds (25 by default for /stream). /bridge/stream returns the same events as SSE, with Last-Event-ID to resume.
| Received type | Fields | To do |
|---|---|---|
chat |
author, message, text |
Show text (already formatted with discord_format) to players |
command |
command_id, command, by |
Run the command if your own whitelist allows it, then send a command_result with the same id |
link_result |
ok, player, discord or error |
Tell the player the result of /discord link |
link_update |
player, discord, groups |
Apply the in-game groups (role sync); unlinked: true if the link is removed |
config_changed |
— | Re-read GET /bridge |
Ignore events that are too old
After your application has been stopped, the queue may contain old commands. Never run a chat or command more than two minutes old (ts), and ignore duplicates (id). The SDKs and the plugin do this for you.
Console commands
Disabled by default. A command launched from Discord with /bridge command bridge:Survival command:whitelist add Steve must pass four barriers:
- the console is enabled on the bridge;
- the person has one of the allowed roles;
- the command matches Robert's whitelist (
*= one or more words:whitelist add *); - the command matches your own whitelist on the application side (the Minecraft plugin has one).
Robert then sends a command event; your application runs it and answers with a command_result event (id, ok, output). The output comes back in the Discord reply (wait of 10 seconds at most). Every command, accepted or refused, is logged. Possible errors on the Discord side: console_disabled, role_denied, command_not_allowed, bridge_offline.
Account linking
- The player types
/bridge link game:minecrafton Discord and gets a 6-digit code, valid for 10 minutes. - They type it in game:
/discord link 482913. - The application sends
{"type": "link_confirm", "code": "482913", "player": {"uuid": "…", "name": "Steve"}}. - Robert records the link, sends
link_resultto the application and, depending on the settings, gives the "linked player" role and changes the Discord nickname ("Jimmy (Steve)").
Afterwards, GET /bridge/links?external_id=… (bridge token) or GET /links (members.read key) tell who is who. Role sync (group_sync) sends a link_update with the list of in-game groups to apply.
Discord commands
| Command | Effect |
|---|---|
/bridge status [bridge] |
Bridge state, players, version, last heartbeat latency |
/bridge players [bridge] |
Connected players |
/bridge command bridge command |
Console command (allowed roles, whitelist) |
/bridge link [game] [bridge] |
Link code to type in game |
See also the Game bridges module page.
Writing your own client
The easiest is the SDK: BridgeClient handles the send queue, reconnection, the cursor and filtering of old events.
import { BridgeClient } from "robert-sdk";
const bridge = new BridgeClient({ baseUrl: "https://robert-bot.com/", token: "rbb_YOUR_TOKEN" });
bridge.on("chat", (e) => console.log(`${e.author.name}: ${e.message}`));
bridge.chat({ uuid: "069a79f4-44e9-4726-a5be-fca90e38aaf5", name: "Steve" }, "Hi!");
await bridge.start({ heartbeat: () => ({ online: 1, max: 20, players: [], version: "My game 1.0", tps: 20 }) });
Spotted a mistake? Got a question? Let us know on the support server.