How to Connect FiveM with Discord: Linking Your RP Server to Your Community
If you're running or playing on a FiveM server, connecting it to Discord transforms how your community communicates. Instead of manually handing out roles or tracking who's in-game, the integration handles it automatically. Here's a clear breakdown of how it works, what it actually does, and the variables that shape how it plays out for different setups.
What "Connecting FiveM with Discord" Actually Means
There isn't a single button that links the two platforms. When people talk about connecting FiveM with Discord, they usually mean one of three things:
- Discord Rich Presence — showing FiveM activity on a player's Discord profile
- Discord OAuth2 / bot-based role sync — verifying Discord accounts on a FiveM server and assigning roles automatically
- Webhook integration — pushing in-game events (player joins, server status, chat) into a Discord channel
Each serves a different purpose, and many servers use all three in combination.
How Discord Rich Presence Works in FiveM 🎮
Rich Presence is the feature that displays what you're doing on your Discord profile — the "Playing FiveM" status with server name, player count, and elapsed time.
FiveM has built-in Rich Presence support. When a player launches FiveM and joins a server, Discord detects it automatically through the FiveM client — no manual setup needed on the player's side. The server owner can customize what appears (server name, logo, status text) using FiveM's native SetDiscordAppId, SetDiscordRichPresenceAsset, and related exports inside a resource script.
To customize Rich Presence on the server side:
- Create a Discord application at discord.com/developers
- Copy your Application ID
- In your FiveM resource's client-side script, call SetDiscordAppId("YOUR_APP_ID")
- Use SetDiscordRichPresenceAsset("image_key") to set a custom logo (uploaded under the app's Rich Presence assets)
- Add the resource to your server.cfg
Players don't need to configure anything — the client handles it once the server resource runs.
Linking Discord Accounts with FiveM via OAuth2
This is the deeper integration — where players verify their Discord identity on the FiveM server, and that triggers automatic Discord role assignment.
The general flow looks like this:
- A player connects to the FiveM server
- They're prompted (usually via a web panel or in-game menu) to authenticate through Discord's OAuth2 flow
- The server reads their Discord user ID
- A bot on the Discord side assigns or removes roles based on logic you define (whitelist status, in-game rank, hours played, etc.)
What You Need to Set This Up
| Component | Purpose |
|---|---|
| Discord Bot | Assigns roles, reads member data |
| Discord Developer App | Provides OAuth2 credentials |
| FiveM Resource (e.g., esx_discord, qb-discordwhitelist) | Handles in-game side of verification |
| Web panel or API endpoint (optional) | Bridges the two platforms |
Popular frameworks like ESX and QBCore have community resources built specifically for Discord linking. Many use the Discord API directly through server-side Lua scripts with PerformHttpRequest.
Bot permissions matter. Your bot needs at minimum the Manage Roles permission, and its role in the Discord hierarchy must sit above any roles it's trying to assign — a common setup mistake.
Setting Up Discord Webhooks for Server Events
Webhooks let your FiveM server push messages into a Discord channel automatically. Common use cases:
- Player join/leave notifications
- Chat logs
- Server restart alerts
- Anticheat or moderation logs
Setup is straightforward:
- In your Discord server, go to a channel's settings → Integrations → Webhooks
- Create a new webhook and copy the URL
- In your FiveM resource, use PerformHttpRequest to POST a JSON payload to that URL whenever the trigger fires
A basic payload looks like: