Skip to main content
This guide walks you through the complete setup process from generating your API token to running the webhook client.
1

Generate an API token

In Discord, use the Sol’s Stat Tracker bot to generate an API token:
/generatetoken
The bot will provide you with a unique API token. Copy this token - you’ll need it in the next step.
Keep your API token private. Anyone with this token can connect to your Sol’s Stat Tracker instance.
2

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
const config = {
    // AUTHENTICATION (REQUIRED)
    "token": "0123456789ABCDEFabcdef0123456789ABCDEFabcdef0123456789ABCDEFabcdef01234567",
    "webhookURL": "PLACE THE WEBHOOK URL HERE",
    
    // ... rest of config
};
Your API token should be a 72-character hexadecimal string. If it looks different, regenerate it using /generatetoken.
3

Create a Discord webhook

In your Discord server, create a webhook:
  1. Go to the channel where you want stats to be posted
  2. Click the channel settings (gear icon)
  3. Navigate to IntegrationsWebhooks
  4. Click New Webhook
  5. Copy the webhook URL
The webhook URL should look like:
https://discord.com/api/webhooks/123456789012345678/AbCdEfGhIjKlMnOpQrStUvWxYz0123456789abcdef
4

Configure your webhook URL

Back in your config.js file, replace "PLACE THE WEBHOOK URL HERE" with your Discord webhook URL:
config.js
const config = {
    // AUTHENTICATION (REQUIRED)
    "token": "0123456789ABCDEFabcdef0123456789ABCDEFabcdef0123456789ABCDEFabcdef01234567",
    "webhookURL": "https://discord.com/api/webhooks/123456789012345678/AbCdEfGhIjKlMnOpQrStUvWxYz0123456789abcdef",
    
    // ... rest of config
};
Save the file after making this change.
5

Run the webhook client

Double-click the run.bat file in your Sol’s Stat Tracker Webhook directory to start the client.You should see console output indicating the connection status:
ID: 123456789012345678 | WS client connected: wss://api.mongoosee.com/solsstattracker/v2/gateway
In your Discord channel, you’ll see a connection confirmation embed with a green checkmark.
6

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 in config.js:

Webhook appearance

Override the default webhook username and avatar:
config.js
"overrideUsername": "Sol's Stats",
"overrideAvatarURL": "https://example.com/avatar.png",

Embed colors

Customize the embed colors for different states:
config.js
"colors": {
    "success": "#6ab183",  // Green for success states
    "error": "#d85a4b",    // Red for error states
    "none": "#777f8d"      // Gray for neutral states
},

Verbose logging

Control whether automated events (like connection status) are posted to Discord:
config.js
"verboseLogging": true,  // Set to false to only show user events
The advanced configuration section contains gateway URL and reconnection settings. Do not change these unless you know what you’re doing, as incorrect values can prevent the client from connecting.

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
"reconnectOnDuplicateConnection": true,  // May cause reconnection loop

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

Next steps

Learn more about configuration options or check out the troubleshooting guide for common issues.

Build docs developers (and LLMs) love