Postback Config

A server-to-server postback URL, validated against its macros. A postback missing {click_id} returns 200 and attributes nothing — this says so before it ships rather than in a reconciliation weeks later.

src/components/ui/postback-config.tsx

About

From the component's own source, where it was written.

A server-to-server postback URL with its macros.

The available macros are listed and validated against the URL. A postback missing {click_id} silently attributes nothing — the requests arrive, they return 200, and no conversion is ever matched — so an unresolved or unknown macro is called out before it ships rather than discovered in a reconciliation weeks later.

http:// is flagged. Postbacks carry payout amounts and click identifiers, and sending them in the clear is a real leak, not a style preference.

Install

npx astralyx-ui add postback-config

Usage

import { PostbackConfig } from '@/components/ui/postback-config'

<PostbackConfig url={url} onUrlChange={setUrl} macros={macros} status="ok" />

Composer

Change the props and the source below follows.

Available macros
  • Your click identifier. Without it nothing can be attributed.
  • Commission for the conversion, in the campaign currency.
  • ISO 4217 code for the payout.
  • The offer the conversion belongs to.
  • approved, pending or rejected.
  • Advertiser's transaction reference, for deduplication.
Firinglast fired 4 minutes ago
Props
tsx
<PostbackConfig url={url} onUrlChange={setUrl} macros={macros} status="ok" />

API

Generated from the source, so it cannot fall behind the code. One table per exported component, then hooks, functions and types.

PostbackConfig

Extends Omit<ComponentProps<'div'>, 'onChange'>.

PropTypeDefaultDescription
urlstring—Controlled or uncontrolled. Uncontrolled is fine for a preview; a real config screen owns the value.
onUrlChange(url: string) => void—Controlled or uncontrolled. Uncontrolled is fine for a preview; a real config screen owns the value.
macrosMacro[]required{ token, description, required? }. Clicking one appends it to the URL, which beats retyping braces.
method'GET' | 'POST''GET'—
onMethodChange(method: 'GET' | 'POST') => void——
lastFiredReactNode—Delivery health. "Firing, last 4 minutes ago" is the answer to the only question anyone opens this screen with.
status'ok' | 'failing' | 'untested'—Delivery health. "Firing, last 4 minutes ago" is the answer to the only question anyone opens this screen with.
urlLabelReactNode'Postback URL'—
urlPlaceholderstring'https://tracker.example.com/pb?cid={click_id}&payout={payout}'—
macrosLabelReactNode'Available macros'—
requiredLabelReactNode'required'Badge on a macro that must appear in the URL.
inUseLabelstring'in use'Accessible name for the tick beside a macro already in the URL.
insecureNoteReactNode'This posts click identifiers and payouts over plain HTTP.'—
missingNote(tokens: string[]) => ReactNodeDEFAULT_MISSING_NOTEWarning for required macros absent from the URL.
unknownNote(tokens: string[]) => ReactNodeDEFAULT_UNKNOWN_NOTE—
statusLabels{ ok?: ReactNode; failing?: ReactNode; untested?: ReactNode }{ ok: 'Firing', failing: 'Failing', untested: 'Not tested' }—
lastFiredLabelReactNode'last fired'Precedes the last-fired time.

Types

Macro

A server-to-server postback URL with its macros.

FieldTypeDescription
tokenstring—
descriptionReactNode—
required?boolean—

Behaviour

TopicDetailDescription
validationliveRequired macros that are missing, macros that are not in your list, and plain http:// are each called out separately.