FiveM Discord integration
Almost every serious FiveM server runs its community on Discord, so wiring the two together is one of the first things a server needs: granting in-game perks from Discord roles, logging events to a channel, and linking a player to their Discord account. This guide covers what that involves and a free library that handles it.
The jobs
What you usually need
Discord integration on a FiveM server tends to come down to four jobs. Read a player's Discord roles and grant in-game permissions from them. Check whether a member has a required permission before allowing an action. Post events, like a ban or a purchase, to a Discord channel through a webhook. And keep a link between a player's FiveM identifiers and their Discord ID so the two stay in sync.
- Role syncing from Discord to in-game permissions.
- Permission checks before privileged actions.
- Webhook logging of server events to a channel.
- Linking FiveM identifiers to Discord accounts.
Under the hood
How it works
Role and permission data comes from the Discord REST API using a bot token, so your server needs a Discord application with a bot in your guild. Webhooks are simpler, one webhook URL per channel with no bot needed, but they should retry politely because Discord rate-limits them. Player linking means storing a small record that maps FiveM identifiers, the license, steam, and discord prefixes, to a Discord ID.
The tool
A free library that does it
AL DiscordAPI is a free, zero-dependency library that covers all four jobs. It has a Node core using native fetch on Node 18 or newer and a matching FiveM Lua bridge, so the same concepts work in a web service and in-game. It does role syncing over the Discord REST API v10, effective-permission checks, rate-limit-aware webhook posting, a player store that maps FiveM identifiers to Discord IDs, and small server utilities. It is MIT licensed and yours to extend, and it is the easiest way into the appleluis.ltd toolset.
Questions
Do I need a Discord bot for role syncing?
Yes. Reading and changing roles uses the Discord REST API with a bot token, so you need a Discord application with a bot in your guild. Webhook logging does not need a bot, just a webhook URL.
Does this work outside FiveM?
Yes. AL DiscordAPI has a Node core that runs in any Node 18 or newer service, plus a FiveM Lua bridge, so the same integration works on a web backend and in-game.
Is it really free?
Yes, AL DiscordAPI is free and MIT licensed, with no key required. It is the free entry point to the store, and it doubles as a working example of how the paid products validate their licenses.
Will webhook logging get rate-limited?
Discord rate-limits webhooks, so posting should back off and retry. AL DiscordAPI does rate-limit-aware retry for you rather than dropping messages.