How to Add Webhooks

Webhooks are essential for integrating external services with your FiveM server, such as logging events, sending notifications, or tracking player activity. Follow these steps to correctly add your webhook to the editable_server.lua file.

Step 1: Obtain Your Webhook URL

  • Create or Use an Existing Webhook:

    • If you haven't already, create a webhook in your preferred service (e.g., Discord, Slack).

    • Copy the webhook URL provided by the service.

  • Keep Your Webhook URL Secure:

    • Treat your webhook URL like a password. Do not share it publicly or expose it in unsecured locations.

Step 2: Locate the editable_server.lua File

  • Access Your Server Files:

    • Connect to your server via FTP or through your file manager.

    • Navigate to the directory where your server's scripts are stored.

  • Open editable_server.lua:

    • Locate the editable_server.lua file in the script directory.

    • Open the file using a text editor (e.g., Notepad++, VS Code).

Step 3: Insert Your Webhook URL

  • Find the Webhook Section:

    • Inside the editable_server.lua file, search for the section where webhook URLs are defined.

    • This section is typically marked with a comment like -- Webhooks or similar.

  • Insert Your Webhook URL:

    • Replace the placeholder URL with your actual webhook URL. It might look something like this:

discord = {
    ['webhook'] = 'https://discord.com/api/webhooks/xxxxxxxx/xxxxxxxx',
    ['name'] = 'Rainmad Scripts',
    ['image'] = 'https://cdn.discordapp.com/avatars/869260464775921675/dff6a13a5361bc520ef126991405caae.png?size=1024',
}
  • Ensure you paste the URL inside the quotation marks, and do not alter any other parts of the code.

  • Save Your Changes:

    • After pasting your webhook URL, save the editable_server.lua file.

Step 4: Test the Webhook

  • Restart Your Server:

    • After saving the file, restart your server to apply the changes.

  • Trigger an Event:

    • Perform an action that would trigger the webhook (e.g., player joining, sending a message, etc.).

    • Check your webhook destination (e.g., Discord channel) to confirm the event was logged.

  • Verify the Webhook Functionality:

    • Ensure that the data is being sent correctly to the webhook URL.

    • If nothing appears, double-check the webhook URL and ensure it’s correctly placed in the editable_server.lua file.

Troubleshooting

  • Webhook Not Working: Double-check the URL for any typos and ensure it is correctly placed within the editable_server.lua file.

  • No Events Triggered: Verify that the server is correctly triggering the event linked to the webhook.

  • Security Note: Always ensure your webhook URL is kept private to prevent unauthorized access.

Last updated