Nex Webhook Handler Pattern

    1

    Generate production-grade, idempotent FastAPI webhook handlers with signature verification and audit logging.

    Free

    0 installsSecurity scanned

    Works with the AI tools you already use

    CClaude CodeCCursorCCodex CLIGGitHub CopilotGGemini CLIVVS CodeWWindsurfMManus+14 more

    See it in action

    You say

    Add a Stripe webhook handler to my FastAPI app that handles checkout.session.completed events using ARQ.

    Your agent does

    I have generated the webhooks/ directory.

    • verifiers/stripe.py: Implements HMAC-SHA256 signature checks.
    • handlers/stripe.py: FastAPI route with verify-store-enqueue logic.
    • audit.py: SQLAlchemy/SQLModel for webhook_events with UNIQUE(provider, event_id).
    • jobs/stripe.py: ARQ worker stub.

    About this skill

    The problem

    Webhook handlers often fail due to slow processing timeouts, lack of idempotency, or incorrect signature verification. Developers frequently struggle with replay attacks and lose visibility into missed deliveries when workers crash.

    What it does

    • Generates provider-specific cryptographic signature verification for Stripe, Resend, Clerk, and others.
    • Implements a verify-then-store-then-enqueue flow to ensure data integrity.
    • Creates an audit table with a unique constraint on provider event IDs to prevent duplicate processing.
    • Offloads heavy logic to ARQ background jobs, allowing the FastAPI handler to return a 200 OK within one second.
    • Includes a replay CLI to re-run unprocessed or failed events from the audit log.

    Frameworks & tools

    FastAPI, ARQ (Redis-based task queue), PostgreSQL, and Pydantic.

    Why this beats prompting it yourself

    Signature verification contracts vary wildly between providers. This skill uses hard-coded, production-tested patterns for header parsing and timestamp tolerance that generic prompts often hallucinate or oversimplify, leaving you vulnerable to replay attacks.

    Use cases

    • Hardening a Stripe integration against signature-bypass and replay attacks.
    • Recovering from worker outages by replaying missed events from an audit table.
    • Standardizing webhook ingestion across multiple providers like Cloudflare and Postmark.
    • Debugging "silent failures" where webhooks fire but no business logic executes.

    Known limitations

    Designed specifically for FastAPI and ARQ. Porting to Express or Next.js requires manual adaptation of the dependency injection and queueing logic.

    How to install

    Drop the file into your AI Agent. Works with Claude, Cursor, ChatGPT, and 20+ more.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free forever

    No account required to browse

    Trust & safety

    Security scanned

    Verified clean today

    • Free to download with an account

    Listedtoday

    Frequently Asked Questions

    Free