Documentation Index
Fetch the complete documentation index at: https://docs.leaf7.fun/llms.txt
Use this file to discover all available pages before exploring further.
L7_SEND_WEBHOOK
TheL7_SEND_WEBHOOK macro lets you fire Discord webhooks directly from your Lua scripts — without ever exposing your webhook URL to the client. The URL and payload template are stored securely on the server; only the evaluated variables are sent by the client.
How it works
Defining a webhook in your source
The macro takes exactly two arguments:- The webhook URL (must be a string literal).
- The Discord JSON payload (as a Lua table).
..) or direct variable references inside the table. Leaf7’s preprocessor automatically detects these variables, stores the template with placeholders on the server, and sets up the client to only send the variable values.
Behind the scenes, Leaf7 strips the URL and the table structure out of your script entirely. It replaces the block with a secure stub that only transmits
{ "player.Name": "...", "kills": "15", "game.JobId": "..." } to the server.Server-Side Variables
You can inject trusted data directly on the server by using%VARIABLE% strings in your template. The client cannot spoof these values:
| Variable | Description |
|---|---|
%CLIENT_IP% | The client’s IP address |
%USER_KEY% | The script key used for authentication |
%DISCORD_ID% | The Discord ID linked to the key |
%USER_NOTE% | The note set on the buyer key |
Input Sanitization (L7_SANITIZE)
To prevent users from injecting malicious content (like @everyone pings or malicious links) into your webhooks via variable manipulation, use the inline L7_SANITIZE(expression, "regex") macro.
If a variable fails to match the provided regex, the server blocks the webhook entirely.
Multiple webhooks
Each project supports up to 6 webhook slots (0-5). You can just callL7_SEND_WEBHOOK multiple times in your script; Leaf7 automatically assigns a slot ID to each call.
Rate limits
The webhook relay enforces a rate limit (typically 30 requests per minute per IP). Exceeding this returns429 Too Many Requests.