How to Build Discord Webhook for Server Boost Status Tracking
🔍 WiseChecker

How to Build Discord Webhook for Server Boost Status Tracking

Discord Server Boosts unlock perks like higher audio quality, custom emoji slots, and vanity URLs. Tracking when a boost happens or expires helps server administrators understand engagement and reward supporters. Manual monitoring is tedious and error-prone. This article explains how to build a Discord webhook that automatically sends notifications when a server boost occurs or when boost levels change.

Key Takeaways: Building a Discord Webhook for Boost Tracking

  • Server Settings > Integrations > Webhooks > New Webhook: Create a webhook URL that Discord will post events to.
  • Discord API Gateway with bot token: Subscribe to the GUILD_MEMBER_UPDATE and GUILD_UPDATE events to capture boost data.
  • JSON payload with embed structure: Format the message using Discord embed objects for clear, styled notifications.

ADVERTISEMENT

How Discord Server Boosts Work and Why a Webhook Helps

Discord Server Boosts are a feature of Discord Nitro subscribers. When a user boosts a server, that server gains experience points toward a boost level. Levels range from Level 1 at 2 boosts to Level 3 at 15 boosts. Each level unlocks specific perks like 1080p 60fps video streaming, 250 emoji slots, or a custom invite link.

Discord does not send built-in notifications when a boost ends or when a user removes their boost. Server administrators must manually check the Server Boost page. A webhook solution automates this by listening for specific Discord Gateway events and posting a formatted message to a channel of your choice.

What a Webhook Does in This Context

A webhook is a user-defined HTTP callback. When Discord detects a boost event, it sends a POST request to the webhook URL. Your bot or script receives that data, processes it, and sends a custom message back to a Discord channel. This lets you track boosts in real time without refreshing any page.

Prerequisites

Before building the webhook, you need:

  • A Discord server where you have the Manage Server permission
  • A Discord application and bot token from the Discord Developer Portal
  • A server or cloud function (like a VPS, Raspberry Pi, or AWS Lambda) to run the listener script
  • Basic familiarity with JavaScript or Python

Steps to Create the Webhook and Listener

The process has two parts: creating the webhook URL inside Discord and writing a script that listens for boost events and sends notifications.

  1. Create a Webhook URL in Discord
    Open your Discord server. Go to Server Settings > Integrations > Webhooks. Click New Webhook. Name it Boost Tracker. Select the channel where notifications will appear. Click Copy Webhook URL and save it. You will use this URL to send messages.
  2. Create a Discord Application and Bot
    Go to the Discord Developer Portal at discord.com/developers/applications. Click New Application and name it Boost Monitor. Go to the Bot tab and click Add Bot. Copy the bot token. This token authenticates the bot to the Discord Gateway.
  3. Invite the Bot to Your Server
    In the Developer Portal, go to OAuth2 > URL Generator. Select the bot scope. Under Bot Permissions, select Send Messages, Read Messages, and Use Slash Commands. Copy the generated URL and open it in a browser. Select your server and authorize the bot.
  4. Write the Listener Script
    Create a file named boost-tracker.js or boost-tracker.py. Use a library like discord.js for JavaScript or discord.py for Python. Subscribe to the GUILD_MEMBER_UPDATE event. When the event fires, check if the premium_since field changed. If it was null and now has a timestamp, a boost was added. If it had a timestamp and is now null, a boost was removed. Also subscribe to GUILD_UPDATE to detect boost level changes.
  5. Format the Notification Message
    Build a Discord embed object with title, description, color, and timestamp fields. Example: title: Server Boost Received, description: User boosted the server. Use the webhook URL from step 1 to send the embed via a POST request to that URL. Include the field content-type: application/json.
  6. Deploy and Test the Script
    Run the script on your server. Manually boost your server using a test Nitro account. Check the channel for the notification. If the message appears, the webhook works. If not, check the script logs for errors in the event payload.

Sample JavaScript Code Snippet

Below is a minimal example using discord.js v14. Replace YOUR_BOT_TOKEN and YOUR_WEBHOOK_URL with your actual values.

const { Client, GatewayIntentBits, WebhookClient } = require('discord.js');
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers] });
const webhookClient = new WebhookClient({ url: 'YOUR_WEBHOOK_URL' });

client.on('guildMemberUpdate', (oldMember, newMember) => {
  if (oldMember.premiumSince === null && newMember.premiumSince !== null) {
    webhookClient.send({
      embeds: [{
        title: 'Server Boost Received',
        description: `${newMember.user.tag} boosted the server`,
        color: 0x9b59b6,
        timestamp: new Date()
      }]
    });
  }
  if (oldMember.premiumSince !== null && newMember.premiumSince === null) {
    webhookClient.send({
      embeds: [{
        title: 'Server Boost Removed',
        description: `${newMember.user.tag} removed their boost`,
        color: 0xe74c3c,
        timestamp: new Date()
      }]
    });
  }
});

client.login('YOUR_BOT_TOKEN');

ADVERTISEMENT

Common Issues When Setting Up the Boost Webhook

Bot Does Not Receive GUILD_MEMBER_UPDATE Events

The most common cause is missing the Server Members Intent. In the Developer Portal under Bot, enable Server Members Intent. Without this intent, the bot cannot see member updates including boost changes. Also ensure the bot has the Read Messages permission in the server.

Webhook Sends Messages but They Are Blank

This happens when the embed object is malformed. Verify that all required embed fields are present: title or description. Check that the JSON payload is valid. Use a JSON validator if needed. Also confirm that the webhook URL is correct and the channel still exists.

Boost Removal Is Not Detected

Discord delays sending the GUILD_MEMBER_UPDATE event when a user removes a boost. The delay can be up to several minutes. Do not expect instant removal notifications. Also note that if the user leaves the server entirely, the event may not fire. In that case, you can poll the guild boost status periodically using the REST API endpoint GET /guilds/{guild.id}/premium/subscriptions.

Script Crashes After a Few Hours

Unhandled promise rejections are the typical culprit. Wrap all async operations in try-catch blocks. Use process.on(‘unhandledRejection’) to log errors. Run the script with a process manager like PM2 to automatically restart it on failure.

Item Webhook with Bot Manual Check
Setup time 30 minutes to 1 hour 0 minutes
Real-time updates Yes, within seconds No
Boost removal detection Delayed but automatic Must refresh Server Boost page
Custom formatting Full control via embed None
Requires coding Yes No

Building a Discord webhook for server boost tracking gives you automated, real-time notifications without manual page refreshes. Start by creating the webhook URL in your server settings, then write a listener script using the Discord Gateway. Use the sample JavaScript code as a base and adjust the embed format to match your server style. For production use, deploy the script on a reliable host and add error logging to handle crashes. Advanced users can extend the script to log boost history to a database or trigger role assignments based on boost count.

ADVERTISEMENT