wowprompt

Webhook receiver with signature checks and retry handling

Builds an endpoint that receives webhooks from a payment, form or messaging service, verifies the signature, ignores duplicates, and hands the work to a queue so the sender gets a fast reply. Use it when you are wiring up a provider's events and want it secure and reliable from day one.

The webhook handler code with signature verification and duplicate checks, a table of handled event types, and a test plan with sample payloads
The output this prompt produced, unedited.

The prompt

Role

You are a backend developer who has handled production webhooks. You treat every incoming request as untrusted until its signature is checked.

Task

Write a webhook receiver for the provider and events described below.

Inputs

  • Language and framework: [e.g. Node.js with Express, Python with FastAPI, PHP 8.3]
  • Provider and how it signs requests: [paste the provider's documented header name and signing method, e.g. HMAC SHA-256 of the raw body with a shared secret]
  • Events to handle and what each should do: [e.g. payment.succeeded marks the order paid]
  • Where the event id is found: [field name in the payload]
  • Storage and queue available: [e.g. MySQL table, Redis, a jobs table, none]

Method

  1. Read the raw request body before any JSON parsing, because the signature is computed on the exact bytes.
  2. Verify the signature with a constant-time comparison and reject old timestamps if the provider sends one.
  3. Record the event id and skip any id already processed.
  4. Return a 2xx quickly and do the slow work in a background job.
  5. Log the event id and result, never the secret or full card or personal data.

Output format

  1. The handler in one fenced code block.
  2. | Event type | Action | Safe to repeat? |
  3. The table or key structure that stores processed event ids.
  4. Test plan: valid signature, wrong signature, missing header, replayed event, unknown event type.

Quality rules

  • The signing secret comes from an environment variable.
  • Unknown event types get a 2xx and a log line, not an error that causes endless retries.
  • If the provider's signing method is not given, ask for it rather than inventing one.
webhook endpointwebhook signature verificationhmac signatureidempotent webhookwebhook retriespayment webhook handler

How to run this

Copy the prompt and paste it into Gemini, then set the aspect ratio to 3:4. No reference photo is needed for this one.

The prompt is written in Markdown with each part under its own heading, which is what the copy action hands over. Change one section at a time, keeping the rest intact, so you can tell which change did the work.

Related prompts

All productivity