Generate an API token
In Discord, use the Sol’s Stat Tracker bot to generate an API token:The bot will provide you with a unique API token. Copy this token - you’ll need it in the next step.
Configure your API token
Open the
config.js file in your Sol’s Stat Tracker Webhook directory using any text editor.Replace "PLACE YOUR API TOKEN HERE" with your actual API token:config.js
Your API token should be a 72-character hexadecimal string. If it looks different, regenerate it using
/generatetoken.Create a Discord webhook
In your Discord server, create a webhook:
- Go to the channel where you want stats to be posted
- Click the channel settings (gear icon)
- Navigate to Integrations → Webhooks
- Click New Webhook
- Copy the webhook URL
Configure your webhook URL
Back in your Save the file after making this change.
config.js file, replace "PLACE THE WEBHOOK URL HERE" with your Discord webhook URL:config.js
Run the webhook client
Double-click the In your Discord channel, you’ll see a connection confirmation embed with a green checkmark.
run.bat file in your Sol’s Stat Tracker Webhook directory to start the client.You should see console output indicating the connection status:Test the connection
In Discord, enable or disable your Sol’s Stat Tracker to test the webhook:
- When enabled, you’ll see a success embed (green)
- When disabled, you’ll see an error embed (red)
- Stats will automatically post when detected
If you don’t see messages appearing, check the console window for error messages and verify your token and webhook URL are correct.
Optional customization
You can customize additional settings inconfig.js:
Webhook appearance
Override the default webhook username and avatar:config.js
Embed colors
Customize the embed colors for different states:config.js
Verbose logging
Control whether automated events (like connection status) are posted to Discord:config.js
Troubleshooting
Connection errors
If you see error code 4001, 4002, or 4004 in the console:- 4001: API token is missing - verify you’ve set the token in
config.js - 4002: API token is invalid - regenerate using
/generatetoken - 4004: API token has been deleted - generate a new token
Duplicate connection (4003)
This error means the API token is already in use by another client. Only one client can be connected per token at a time. By default, the client won’t reconnect on duplicate connection errors. You can change this behavior:config.js
Automatic reconnection
The client automatically reconnects with exponential backoff:- Initial reconnect interval: 31 seconds
- Maximum reconnect interval: 120 seconds (configurable via
maxReconnectInterval) - Interval doubles after each failed reconnection attempt