Servicepartner
PLZ-Lookup
Webhooks
Deploy-Anleitung
Deine Edge Function URL (nach dem Deploy):
Kopieren
GET
/functions/v1/servicepartner
Kopieren
Alle Servicepartner abrufen
?type= partner | xxl – nach Typ filtern
?city= Stadtname (partial match)
?plz= Postleitzahl (exact)
?q= Freitext-Suche über Name, Stadt, Adresse
?format= json (Standard) | geojson
GET
/functions/v1/servicepartner/nearby?plz=10115
Kopieren
Nächste Servicepartner zu einer PLZ – ideal für Chatbots & Melibo
?plz= Ausgangspunkt – erforderlich
?radius= Umkreis in km (Standard: 30)
?limit= Max. Ergebnisse (Standard: 5, max: 50)
?type= partner | xxl (Standard: alle)
{
"query": {
"plz": "10115",
"place": "Berlin Mitte",
"latitude": 52.5317,
"longitude": 13.3872,
"radius_km": 30,
"limit": 5,
"type": "alle"
},
"count": 5,
"data": [
{
"name": "SPOKS (Prenzlauer Berg)",
"address": "Prenzlauer Allee 189, 10405 Berlin",
"city": "Berlin",
"distance_km": 2.1,
"type": "partner"
},
...
]
}
GET
/functions/v1/servicepartner?format=geojson
Kopieren
GeoJSON-Format für Kartenanwendungen
Beispiel-Response:
{
"count": 51,
"filters": { "type": "partner", "city": null, "plz": null, "q": null },
"data": [
{
"id": "a1b2c3...",
"name": "Bakkie (Hamburg)",
"address": "Knoopstr. 5, 21073 Hamburg",
"city": "Hamburg",
"plz": "21073",
"lat": 53.45872116,
"lng": 9.977884293,
"radius_km": 20,
"type": "partner"
},
...
]
}
💡 Melibo-Integration: Im Melibo-Editor unter Datensätze → HTTP-Request die GET-URL eintragen. Kein API-Key nötig (CORS offen).
PLZ → Koordinaten & Ortsnamen als GET-API aus der zipcodes_de-Tabelle.
Kopieren
GET
/functions/v1/zipcodes?plz=10115
Kopieren
Koordinaten & Ortsnamen einer PLZ abrufen
?plz= 5-stellige Postleitzahl – erforderlich
?format= json (Standard) | geojson
Beispiel-Response:
{
"plz": "10115",
"count": 2,
"data": [
{
"zipcode": "10115",
"place": "Berlin Mitte",
"state": "Berlin",
"state_code": "BE",
"community": "Berlin",
"latitude": 52.5317,
"longitude": 13.3872
},
{
"zipcode": "10115",
"place": "Berlin Tiergarten",
"state": "Berlin",
"state_code": "BE",
"community": "Berlin",
"latitude": 52.5163,
"longitude": 13.3777
}
]
}
GeoJSON-Format (?format=geojson):
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": { "type": "Point", "coordinates": [13.3872, 52.5317] },
"properties": { "zipcode": "10115", "place": "Berlin Mitte", ... }
}
]
}
💡 Da zipcodes_de Duplikate enthält, kann eine PLZ mehrere Einträge liefern (verschiedene Ortsteile). Für die Umkreissuche wird der erste Eintrag als Mittelpunkt verwendet.
Webhooks werden automatisch ausgelöst, wenn Servicepartner erstellt, bearbeitet oder gelöscht werden.
Payload-Format: POST mit JSON-Body. Mit Secret wird ein
X-Webhook-Signature: sha256=... Header mitgesendet.
{
"event": "update",
"timestamp": "2026-03-23T10:00:00.000Z",
"table": "servicepartner",
"data": { "id": "...", "name": "Bakkie (Hamburg)", ... },
"previous_data": { ... }
}
1
Supabase CLI installieren
npm install -g supabase
2
Webhook-Tabelle anlegen
Im Supabase SQL-Editor supabase_webhooks.sql ausführen.
3
Edge Functions deployen
supabase login
supabase link --project-ref DEINE_PROJECT_REF
supabase functions deploy servicepartner
supabase functions deploy webhook-dispatcher
supabase functions deploy zipcodes
4
Database Webhook einrichten
Supabase Dashboard → Database → Webhooks → Create a new hook
• Name: servicepartner_changes
• Table: servicepartner
• Events: INSERT, UPDATE, DELETE
• Type: Supabase Edge Function
• Function: webhook-dispatcher
5
Edge Function URL in dieses Feld oben eintragen
Format: https://DEIN_PROJECT_REF.supabase.co/functions/v1/servicepartner