Documentation Index
Fetch the complete documentation index at: https://mintlify.com/discord/discord-interactions-js/llms.txt
Use this file to discover all available pages before exploring further.
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
A ping event. This is typically sent by Discord to verify that your webhook endpoint is operational.
EVENT
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,
}