Rezept: Lead-Pipeline aus Webformular
Webformular per Mail → Supabase-Lead → CRM-Tool → Slack-Notification.
Klassischer B2B-Flow: ein Interessent füllt das Kontaktformular auf der Website aus, Mail kommt rein, der Lead muss erfasst, qualifiziert und dem richtigen Vertriebler zugewiesen werden.
Ziel
- Webformular schickt strukturierte Mail an Workspace-Adresse
- Plattform extrahiert Felder (Name, Firma, E-Mail, Anliegen, Größe)
- Lead landet in Supabase-Tabelle mit Score
- Bei
score >= 7: sofort Slack-Notification an Sales - Bei
score < 7: stillere Eintragung, später bearbeitbar
Voraussetzungen
- Webformular, das per Mail an dich schickt (z. B. Typeform, Tally, eigenes Formular)
- Supabase-Projekt mit
leads-Tabelle - Slack-Workspace mit Incoming Webhook
1. Supabase-Tabelle
create table leads (
id uuid primary key default gen_random_uuid(),
created_at timestamptz default now(),
name text,
company text,
email text,
phone text,
company_size text,
interest text,
raw_message text,
score integer,
assigned_to text,
status text default 'new'
);
2. APIs in apis.php
<?php
return [
'apis' => [
'supabase' => [
'base_url' => 'https://xxx.supabase.co/rest/v1/',
'headers' => [
'apikey' => 'eyJhbGciOi…',
'Authorization' => 'Bearer eyJhbGciOi…',
'Content-Type' => 'application/json',
'Prefer' => 'return=representation',
],
],
'slack' => [
'base_url' => 'https://hooks.slack.com/services/',
'headers' => ['Content-Type' => 'application/json'],
],
],
];
3. Tool: Lead anlegen
tools/leads/createLead.php:
<?php
return [
'tools' => [
'createLead' => [
'description' => 'Lead in Supabase anlegen.',
'parameters' => [
'type' => 'object',
'properties' => [
'name' => ['type' => 'string'],
'company' => ['type' => 'string'],
'email' => ['type' => 'string'],
'phone' => ['type' => 'string'],
'company_size' => ['type' => 'string'],
'interest' => ['type' => 'string'],
'raw_message' => ['type' => 'string'],
'score' => ['type' => 'integer', 'description' => '1-10, geschätzte Lead-Qualität'],
],
'required' => ['email', 'interest', 'score'],
],
'api' => 'supabase',
'method' => 'POST',
'path' => 'leads',
'body' => [
'name' => '{name}',
'company' => '{company}',
'email' => '{email}',
'phone' => '{phone}',
'company_size' => '{company_size}',
'interest' => '{interest}',
'raw_message' => '{raw_message}',
'score' => '{score}',
],
'mapping' => [
'id' => '[0].id',
'created_at' => '[0].created_at',
],
],
],
];
4. Tool: Slack-Notification
tools/notify/notifySalesHotLead.php:
<?php
return [
'tools' => [
'notifySalesHotLead' => [
'description' => 'Schickt eine Slack-Nachricht an den Sales-Channel — nur für Leads mit hohem Score.',
'parameters' => [
'type' => 'object',
'properties' => [
'name' => ['type' => 'string'],
'company' => ['type' => 'string'],
'email' => ['type' => 'string'],
'interest' => ['type' => 'string'],
'score' => ['type' => 'integer'],
],
'required' => ['name', 'company', 'email', 'interest', 'score'],
],
'api' => 'slack',
'method' => 'POST',
'path' => 'TXXXX/BXXXX/cxxxxxxxx', // Webhook-Pfad
'body' => [
'text' => '🔥 *Heißer Lead* von {company} ({score}/10)\n*{name}* · {email}\n_{interest}_',
],
],
],
];
5. Email-Prompt
email.php:
<?php
return [
'email.prompt' => <<<PROMPT
Du verarbeitest Webformular-Anfragen.
Ablauf:
1. Extrahiere aus dem Mail-Body: Name, Firma, E-Mail, Telefon,
Firmengröße (wenn genannt), und das eigentliche Anliegen
2. Score 1-10 schätzen (10 = klares Kaufinteresse, große Firma,
konkrete Anforderung; 1 = generische Anfrage, Studierende,
Wettbewerb)
3. createLead aufrufen mit allen Feldern
4. Wenn score >= 7: zusätzlich notifySalesHotLead aufrufen
Score-Heuristik:
- 9-10: konkrete Bedarfsanfrage, Firma > 50 MA, Budget angedeutet
- 6-8: ernste Anfrage, mittlere Firma, eindeutige Use-Case
- 3-5: allgemeine Anfrage, kleine Firma oder unklare Rolle
- 1-2: offensichtlich Spam, Studierende, Wettbewerber-Recherche
Antworte am Ende mit einer kurzen Notiz, was du gemacht hast.
PROMPT,
];
6. Tool-Allowlist
Ergänze in derselben email.php:
<?php
return [
'email.tools' => [
'createLead',
'notifySalesHotLead',
],
];
7. Testen
- Test-Mail mit Beispiel-Webformular-Inhalt schicken
tm monitor→ MAILcreateLead→ ggf.notifySalesHotLead- In Supabase prüfen: Lead steht mit korrektem Score drin
- Slack-Channel prüfen bei hohem Score
Erweiterungen
- Auto-Reply: Tool
sendAutoReply, das eine kurze „Wir melden uns innerhalb 24h"-Mail zurückschickt - Round-Robin-Zuweisung:
assignToNextSalesPerson— speichert inleads.assigned_to - Dubletten-Erkennung: vor
createLeadeinfindLeadByEmail— bei Treffer nurlast_contact_atupdaten - CRM-Integration (HubSpot, Pipedrive): zusätzliches Tool, das den Lead auch dort spiegelt
- Wöchentlicher Bericht: Scheduled Task, der pro Sales-Person die offenen Leads zusammenfasst