"use client"; import { useState } from "react"; import { postWebhook } from "@/lib/n8n"; type HelloResponse = { message?: string }; // Pfad des eigenen Webhooks mit Kürzel, zum Beispiel "anna-hello" (ohne /webhook/). // In der E&P-n8n gehört jeder Pfad genau einem Workflow. Ohne Angabe ruft die Seite nichts auf. const HELLO_PATH = (process.env.NEXT_PUBLIC_HELLO_PATH || "").trim(); // Beispielseite im E&P-Layout. Kopf und Fuß kommen aus app/layout.tsx, // Farben und Bausteine (ep-karte, ep-feld, ep-knopf, ep-cta, ep-hinweis, ep-fehler) aus app/globals.css. export default function Home() { const [name, setName] = useState(""); const [answer, setAnswer] = useState(null); const [error, setError] = useState(null); const [loading, setLoading] = useState(false); async function onSubmit(e: React.FormEvent) { e.preventDefault(); setError(null); setAnswer(null); if (!HELLO_PATH) { setError( "NEXT_PUBLIC_HELLO_PATH fehlt. Beim ersten Veröffentlichen den eigenen Pfad mitgeben, zum Beispiel anna-hello.", ); return; } setLoading(true); try { const res = await postWebhook(HELLO_PATH, { name }); setAnswer(res.message ?? JSON.stringify(res)); } catch (err) { setError(err instanceof Error ? err.message : String(err)); } finally { setLoading(false); } } return (

Hallo aus n8n

Das Formular ruft einen n8n-Webhook deines eigenen Workflows auf (Vorlage hello-webhook.json, Pfad /webhook/{HELLO_PATH || "anna-hello"}).

setName(e.target.value)} placeholder="Max" className="ep-feld" required />
{answer &&
{answer}
} {error && (
{error}
)}
); }