Receiving Events
There are many event types that can be accessed using different transport methods:- Gateway events are sent over a WebSocket connection between your app and Discord, and is the primary way to receive and send events. Most events are only available via Gateway connections.
- Webhook events are sent to your appโs Webhook Event URL over HTTP.
- SDK events are sent to your app when using the Embedded App SDK.
Using Gateway
Gateway events are the primary way apps can listen and send events. Most events related to resources in Discord, like updates to channels, guilds, roles, and messages, are only available over Gateway. Gateway events are sent over a WebSocket-based Gateway connection between Discord and your app. To receive Gateway events, your app must open and maintain a persistent Gateway connection which you can read details about in the Gateway documentation. To make receiving Gateway events simpler, we suggest using a developer library which helps setup, maintain, and handle common pitfalls with Gateway connections (like rate limits). Details about receiving events using the Gateway API is in the Gateway documentation, and the full list of available Gateway events is in the Gateway Events documentation.Using Webhooks
Webhook events let you receive a small number of events over HTTP. While many events arenโt supported over HTTP, some events like Application Authorized (sent when your app is installed to a user or server) arenโt available using other transport methods like Gateway. Find the list of webhook events and details about subscribing and handling them in the Webhook Events documentation.Using the Embedded App SDK
When developing Activities, you can listen to a collection of SDK events, like updates to a userโs voice status or screen orientation. To listen to SDK events, you can callsubscribe() with the SDK event name.
Details about listening to events using the Embedded App SDK is in the Embedded App SDK documentation.
Next Steps
Gateway Events
Gateway is the primary apps receive events on Discord. Read details about using the Gateway and receiving Gateway Events.
Webhook Events
Read details about receiving and responding a small number of HTTP-based Webhook Events.
Embedded App SDK Events
Read details about subscribing and receiving events specific to your Activity using the Embedded App SDK.