Skip to main content
The WebhookType enum defines the different types of webhook payloads your application can receive from Discord.

Reference

For more information, see the Discord Developer Documentation.

Enum Values

PING

WebhookType.PING = 0
A ping event. This is typically sent by Discord to verify that your webhook endpoint is operational.

EVENT

WebhookType.EVENT = 1
A webhook event. This indicates that the payload contains an actual event that your application has subscribed to.

Usage Example

import { WebhookType } from './webhooks';

function handleWebhook(payload: any) {
  switch (payload.type) {
    case WebhookType.PING:
      console.log('Received ping from Discord');
      // Respond to ping to verify endpoint
      return { type: WebhookType.PING };
    
    case WebhookType.EVENT:
      console.log('Received webhook event');
      // Process the actual event
      processEvent(payload);
      break;
    
    default:
      console.warn('Unknown webhook type:', payload.type);
  }
}

Type Definition

export enum WebhookType {
  /**
   * A ping.
   */
  PING = 0,
  /**
   * A webhook event.
   */
  EVENT = 1,
}

Build docs developers (and LLMs) love