Webhooks
Send from your server (onWebhook)
Deliver every webhook through your own API route: no CORS limits, secrets stay on the server.
"use client";
import { FxChart } from "@fx-charting/max";
export function Chart() {
return (
<FxChart
onWebhook={({ url, body }) =>
fetch("/api/webhook", { method: "POST", body: JSON.stringify({ url, body }) }).then((r) => ({ ok: r.ok }))
}
/>
);
}export async function POST(req) {
const { url, body } = await req.json();
// Optional: only allow your own destinations, add auth headers, log…
const r = await fetch(url, { method: "POST", headers: { "Content-Type": "application/json" }, body });
return Response.json({ ok: r.ok }, { status: r.ok ? 200 : 502 });
}onWebhook receives { url, body, json } (json = the parsed body) and returns { ok }; the result shows in the delivery log.