Implement webhook handlers and event processing for real-time Gamma updates with signature verification and reliable queue processing.
| Event | Description | Key Data |
|---|---|---|
presentation.created |
New presentation | id, title, userId |
presentation.updated |
Slides modified | id, changes[] |
presentation.exported |
Export completed | id, format, url |
presentation.deleted |
Removed | id |
presentation.shared |
Sharing updated | id, shareSettings |
Register endpoint URL with Gamma API specifying events to receive and webhook secret.
Verify x-gamma-signature header using HMAC-SHA256. Acknowledge receipt immediately (200), then process asynchronously.
Route events to type-specific handlers: notify team on create, update database on changes, send export links, cleanup on delete.
Use Bull/Redis queue with 3 retry attempts and exponential backoff. Failed events go to dead letter queue for manual review.
List, update (change events), delete, and test webhooks via API.
See detailed implementation for webhook registration, signature verification, event handlers, Bull queue setup, and webhook management code.
| Error | Cause | Solution |
|---|---|---|
| Invalid signature | Secret mismatch | Verify GAMMA_WEBHOOK_SECRET matches |
| Timeout | Slow processing | Use async queue, acknowledge immediately |
| Duplicate events | Retry delivery | Implement idempotency with event IDs |
| Missing events | Endpoint down | Use reliable hosting with health monitoring |
await gamma.webhooks.test(webhookId);
// Sends test event to registered endpoint
Proceed to gamma-performance-tuning for optimization.