Webhook URL Input

Judges a webhook URL for the environment it's saved to and warns when an edit only changed www or a trailing slash, which senders treat as a failed redirect.

StopsWebhooks pointed at localhost

Installation

pnpm dlx shadcn@latest add https://bollard-ui.vercel.app/r/webhook-url-input.json

The files land in your project. They're yours to edit.

Usage

webhook-url-input-usage.tsx
import { WebhookUrlInput } from "@/components/ui/webhook-url-input"

<WebhookUrlInput
  label="Live endpoint"
  environment="production"
  previousValue="https://api.acme.in/webhooks/stripe"
  defaultValue="https://3f2a-49-36-112-8.ngrok-free.app/webhooks/stripe"
/>

What it catches

  • Tunnel, localhost, private-IP and cloud-metadata hosts (error in production, hint in test)
  • Public request inspectors where anyone can read the payloads
  • Staging hosts saved to production
  • Plain http and a missing path, with fixes
  • Edits that only change www or a trailing slash, with a one-tap revert

Props

WebhookUrlInput props
PropTypeDefault
label

Visible label.

string"Endpoint URL"
value

Controlled URL text.

string—
defaultValue

Initial URL text when uncontrolled.

string""
onValueChange

Called with the URL on every change, including fixes.

(value: string) => void—
environment

Where this endpoint delivers. Tunnels and private hosts are errors in production, hints in test.

WebhookEnvironment"production"
previousValue

The URL saved last time. A change is shown as a diff, with a one-tap revert.

string—
delay

Pause in ms before notes appear while typing. Leaving the field shows them at once.

number500
environmentLabels

Badge text per environment.

Record<WebhookEnvironment, string>{ production: "Production", test: "Test mode" }
savedLabel

Label before the last saved URL.

string"Saved"
fixLabels

Fix button labels, by the kind of note they fix.

Partial<Record<WebhookUrlNote["kind"], string>>—
formatNote

Rewrites a note's message, e.g. to translate it.

(note: WebhookUrlNote) => string(n) => n.message

* required. Also accepts the native props of <input> (className, aria-*, data-*…), passed through to it.

Accessibility

  • Visible <label>; aria-invalid on errors and notes via aria-describedby
  • Notes in a polite live region with icon and text
  • After a fix, focus returns to the input

Only what the source does. Test with your own screen reader and content before shipping.

Limitations

This is a UX guard rail. Enforce on the server: Resolve and validate webhook targets server-side (block private ranges and metadata IPs) to prevent SSRF.

  • Hostname rules only; it does not resolve DNS or send a request
  • Tunnel and inspector lists are starter sets

What it stops

Webhooks pointed at localhost

Also known as

webhook url · endpoint url · callback · ngrok · stripe webhooks · razorpay webhook · dodo payments · integrations

Field type

Dependencies

Pairs well with