Create a Robust and Secure Webhooks API
A complete prompt to generate a production-ready webhooks API with subscription management, cryptographic signatures, intelligent retries and observability.
Paste in your AI
Paste this prompt in ChatGPT, Claude or Gemini and customize the variables in brackets.
Tu es un développeur backend senior spécialisé en architecture événementielle. Conçois une API de webhooks complète pour [TYPE_APPLICATION] en utilisant [LANGAGE_ET_FRAMEWORK].
L'API doit inclure :
-
Gestion des abonnements :
- Endpoint CRUD pour enregistrer/modifier/supprimer des webhooks
- Validation de l'URL de destination (DNS resolution, blocage des IPs privées)
- Support de filtrage par type d'événement
- Stockage des abonnements avec statut actif/inactif/suspendu
-
Dispatch des événements :
- File d'attente asynchrone pour l'envoi (Redis, RabbitMQ ou équivalent)
- Payload JSON standardisé avec : id unique, timestamp, type d'événement, données, version du schema
- Envoi concurrent avec limite de débit configurable par subscriber
-
Sécurité :
- Signature HMAC-SHA256 des payloads (header X-Webhook-Signature)
- Secret unique par abonnement, généré côté serveur
- Endpoint de vérification (challenge/response) à l'enregistrement
- Rate limiting par IP et par subscriber
- Blocage des destinations vers des réseaux internes (SSRF protection)
-
Fiabilité et retries :
- Stratégie de retry avec backoff exponentiel ([NOMBRE_RETRIES] tentatives max)
- Timeouts configurables par requête (défaut : 10 secondes)
- Circuit breaker : désactivation automatique après [SEUIL_ECHECS] échecs consécutifs
- Notification à l'admin quand un webhook est suspendu
-
Observabilité :
- Logging structuré de chaque tentative (statut HTTP, latence, erreur)
- Table d'historique des livraisons consultable via API
- Dashboard endpoint avec métriques : taux de succès, latence P50/P95/P99, webhooks actifs
-
API endpoints :
- POST /webhooks — créer un abonnement
- GET /webhooks — lister les abonnements
- GET /webhooks/:id — détail d'un abonnement
- PUT /webhooks/:id — modifier
- DELETE /webhooks/:id — supprimer
- GET /webhooks/:id/deliveries — historique des livraisons
- POST /webhooks/:id/test — envoyer un événement de test
- GET /webhooks/events — lister les types d'événements disponibles
Fournis le code complet avec : modèles de données (schéma SQL ou ORM), routes, middleware d'authentification, service de dispatch, worker de file d'attente, et tests unitaires pour les fonctions critiques (signature, retry logic, validation URL). Ajoute des commentaires expliquant les choix d'architecture.
Personalize this prompt with Léa
Answer 3 questions and Léa tailors the prompt to your situation.
Why this prompt works
<p>This prompt guides AI to produce a <strong>production-level webhooks API</strong>. It covers the six essential pillars: subscription management, async dispatch, security, reliability, observability and REST API design. Each section is detailed enough to avoid superficial implementations.</p><p>The <strong>[APPLICATION_TYPE]</strong> and <strong>[LANGUAGE_AND_FRAMEWORK]</strong> variables adapt the result to your exact context — whether it is a SaaS in Node.js/Express, a marketplace in Python/FastAPI or an app in Go/Gin. The <strong>[RETRY_COUNT]</strong> and <strong>[FAILURE_THRESHOLD]</strong> variables adjust the reliability policy to your constraints.</p><p>For better results, specify your database (PostgreSQL, MySQL), preferred queue system, and whether you need <strong>specific authentication</strong> (API key, OAuth, JWT). You can also request variants: serverless version, cloud provider integration, or added features like <strong>fan-out</strong> to multiple destinations or past event <strong>replay</strong>.</p>
Use Cases
Expected Output
Complete webhooks API source code with data models, REST routes, async dispatch service, retry worker, security middleware and unit tests, accompanied by comments on architecture choices.
Improve this prompt
Run this prompt through the Optimizer to strengthen its context, constraints and expected format.
Improve this prompt with the OptimizerComments
Be the first to comment on this prompt.
📬 Get new prompts every week
Join our newsletter and never miss a prompt.
Go further
Similar Prompts
Write Integration Tests for an API
Create complete API integration tests with database setup, authentication, CRUD, and end-to-end scenarios.
Sora Prompt for Refactoring Code
Code refactoring is a crucial step in the software development lifecycle, aiming to improve the internal structure of a program without changing its external behavior. With the emergence of generative AI models like OpenAI's Sora, new approaches are emerging to assist developers in this complex task. Sora, thanks to its advanced contextual understanding, can analyze existing code blocks and suggest intelligent restructurings that respect best programming practices. Whether you're looking to eliminate duplicated code, simplify overly long functions, apply recognized design patterns, or improve the overall readability of your codebase, a well-crafted prompt yields relevant and immediately applicable refactoring suggestions. The main challenge lies in the precise formulation of your request: the more context you provide about the existing architecture, technical constraints, and quality goals, the more usable the results will be. This guide offers optimized prompts to get the most out of Sora in your refactoring projects, regardless of your expertise level.
Distributed Tracing with OpenTelemetry
Implement distributed tracing
Terraform Multi-Environment Architecture
Managing multiple environments with Terraform