What are Discord Webhooks?
Discord webhooks allow external applications to post messages to Discord channels automatically. Mythic Framework uses webhooks to send structured, rich embeds with server activity logs.Real-Time Logging
Get instant notifications of important server events
Rich Embeds
Color-coded, formatted messages with detailed information
Centralized Monitoring
All logs in one place for easy staff monitoring
Easy Setup
Simple configuration, works out of the box
Creating Discord Webhooks
1
Create or Select Discord Server
You need a Discord server where you have Manage Webhooks permission.
2
Navigate to Channel Settings
- Right-click the channel where you want logs
- Click βEdit Channelβ
- Go to βIntegrationsβ tab
- Click βWebhooksβ
3
Create New Webhook
- Click βNew Webhookβ or βCreate Webhookβ
- Customize the webhook:
- Name: e.g., βMythic Admin Logsβ, βConnection Logsβ
- Avatar: Optional custom icon
- Click βCopy Webhook URLβ
4
Add to server.cfg
Best Practice: Create separate channels for different log types (admin actions, connections, errors, etc.) to keep logs organized.
Available Webhook Types
Mythic Framework supports multiple webhook types for different logging purposes:1. Admin Logs Webhook
Purpose: Logs all admin actions and commands Variable:discord_admin_webhook
- Admin command usage (/kick, /ban, /tp, etc.)
- Permission grants/revocations
- Server configuration changes
- Resource restarts by admins
- Noclip, god mode, invisibility usage
2. Connection Logs Webhook
Purpose: Tracks player connections and disconnections Variable:discord_connection_webhook
- Player join attempts
- Successful connections
- Disconnections with reason
- Queue position updates
- Connection failures
3. Kill Logs Webhook
Purpose: Logs player deaths and kills for moderation Variable:discord_kill_webhook
- Player kills with weapon used
- Suicide/fall damage deaths
- Vehicle-related deaths
- Distance of kill
- Victim and killer information
4. Error Logs Webhook
Purpose: Critical error and crash reporting Variable:discord_error_webhook
- Server errors and crashes
- Resource errors
- Database connection failures
- Script runtime errors
- Performance warnings
5. General Logs Webhook
Purpose: General-purpose logging Variable:discord_log_webhook
- General server events
- Resource activity
- Miscellaneous framework logging
6. Anti-Cheat Logs Webhook
Purpose: Security and anti-cheat detections Variable:discord_pwnzor_webhook
- Cheat/mod detections
- Suspicious activity (triggering non-existent events)
- Injection attempts
- Resource manipulation
- Automated bans
Recommended Channel Structure
Example Discord Server Structure
Example Discord Server Structure
- Admin logs: Staff only
- Connection logs: Staff + Moderators
- Kill logs: Staff + Moderators
- Error logs: Developers only
- Anti-cheat: Staff only
Complete Configuration Example
Webhook Message Customization
Some webhook features can be customized in resource configuration:Custom Embed Colors
Mythic Framework uses color-coded embeds:Disabling Specific Webhooks
Leave a webhook convar empty to disable that log type:Testing Webhooks
After configuration, test each webhook:1
Start Server
Start your FiveM server with webhook configuration
2
Trigger Test Events
- Admin: Use an admin command
- Connection: Connect to server
- Kill: Kill or get killed by another player
- Error: Intentionally cause an error (restart a resource)
- Anti-Cheat: Trigger detection (if possible in dev)
3
Verify Discord Messages
Check respective Discord channels for log messages
4
Troubleshoot if Needed
See troubleshooting section below
Troubleshooting
Webhook Not Posting
Webhook Not Posting
Problem: Messages not appearing in DiscordSolutions:
-
Verify URL is correct
- URL should start with
https://discord.com/api/webhooks/ - Check for typos or truncation
- Ensure no extra spaces
- URL should start with
-
Check webhook still exists
- Webhooks can be deleted in Discord settings
- Recreate webhook if needed
-
Verify permissions
- Bot/webhook needs permission to post in channel
- Check channel permissions
-
Test webhook manually:
-
Check server console for errors
Rate Limited
Rate Limited
Problem:
429 Too Many Requests errorCause: Discord rate limits webhooks to:- 30 requests per minute per webhook
- 5 requests per second per webhook
- Reduce logging frequency
- Use multiple webhooks for high-traffic logs
- Implement batching in resource configuration
- Add delays between rapid events
Missing Information in Logs
Missing Information in Logs
Problem: Logs donβt contain expected dataSolutions:
- Check resource configuration for filtering settings
- Verify resource has access to required data
- Increase log level to see whatβs being sent:
- Check console for webhook payload logs
Formatting Issues
Formatting Issues
Problem: Messages look broken or poorly formattedSolutions:
- Verify Discord doesnβt have embed display disabled
- Check user/server settings β Text & Images β Show embeds
- Ensure webhook payload is valid JSON
- Test with manual curl request
Webhook Deleted/Invalid
Webhook Deleted/Invalid
Problem:
404 Not Found or webhook disappearedCause: Webhooks can be deleted from Discord settingsSolutions:- Go to Discord channel β Edit Channel β Integrations β Webhooks
- Check if webhook still exists
- If deleted, create new webhook
- Update server.cfg with new URL
- Restart server
Security Best Practices
1
Keep URLs Private
- Never commit webhook URLs to public repositories
- Donβt share webhooks in public channels
- Use environment variables if possible
- Rotate webhooks if compromised
2
Restrict Channel Permissions
- Make log channels staff-only
- Use role permissions to control access
- Consider separate webhooks for different staff ranks
3
Monitor for Abuse
- Watch for unexpected messages
- Check webhook audit log in Discord
- Revoke and recreate if compromised
4
Use Different Webhooks Per Environment
Advanced Configuration
Environment-Specific Webhooks
Use separateserver.cfg files for development and production to point webhooks at different Discord channels:
Custom Webhook Implementation
You can send custom webhook messages from your resources:Webhook Color Reference
Use these color codes for consistent Discord embed styling:Monitoring and Maintenance
Regular Checks
- Verify webhooks still work weekly
- Check for rate limit errors in console
- Monitor Discord channel for spam
- Review and update filters as needed
Webhook Rotation
- Rotate webhooks every 3-6 months
- Immediately rotate if compromised
- Update all server instances
- Document changes
Log Retention
- Discord doesnβt automatically delete messages
- Manually archive old logs periodically
- Use bots for automated cleanup
- Export important logs for records
Staff Training
- Train staff on reading logs
- Document log meanings
- Create response procedures
- Regular log review sessions
Next Steps
Server Configuration
Complete server.cfg settings
Environment Variables
Configure logging and environment
Permissions
Configure admin permissions
Resource Management
Manage resource load order