Webhook URL configuration
The full Discord webhook URL for your target channel. This URL is used by the Discord.js WebhookClient to establish a connection and send messages.Format:
https://discord.com/api/webhooks/{webhook_id}/{webhook_token}Creating a Discord webhook
- Open your Discord server and navigate to the channel where you want to receive stat notifications
- Click the gear icon next to the channel name to open Channel Settings
- Go to Integrations in the left sidebar
- Click Webhooks or View Webhooks
- Click New Webhook or Create Webhook
- Customize the webhook name and avatar (optional)
- Click Copy Webhook URL
- Paste the URL into your
config.jsfile
How the webhook works
The application uses Discord.js’sWebhookClient to communicate with your Discord channel:
- On startup, a WebhookClient is created using your webhook URL
- The client connects to the WebSocket gateway using your API token
- When stat events occur, the gateway sends
executeWebhookactions with message payloads - The webhook client sends these messages as Discord embeds to your channel
- Connection status updates (connected, enabled, disabled, reconnecting) are also sent through the webhook
Webhook message types
Your webhook will receive different types of messages:Status messages
These messages inform you about the connection state:- Connected - WebSocket successfully connected to the gateway (shown only if
verboseLoggingis enabled) - Enabled - Stat tracking has been enabled via the Discord bot
- Disabled - Stat tracking has been disabled via the Discord bot
- Reconnecting - Connection lost, attempting to reconnect (shown only if
verboseLoggingis enabled)
Stat notifications
When stats are found in-game, the webhook receives formatted embed messages with player statistics. The exact format is determined by the Sol’s Stat Tracker service.Security features
The application automatically disables all mentions in webhook messages by setting
allowedMentions: { parse: [] }. This prevents the webhook from pinging users or roles, even if the payload contains mention syntax.Troubleshooting webhook errors
If you see webhook-related errors in the console:- Invalid webhook URL - Verify the URL format is correct and complete
- Webhook not found - The webhook may have been deleted from Discord; create a new one
- Missing permissions - Ensure the webhook has permission to post in the channel
- Rate limited - Discord is rate limiting your webhook; messages will retry automatically