package handlers import ( "net/http" "github.com/go-chi/chi" ) // HandleWebhook handles incoming webhook requests at entrypoint URLs func (h *Handlers) HandleWebhook() http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { // Get entrypoint UUID from URL entrypointUUID := chi.URLParam(r, "uuid") if entrypointUUID == "" { http.NotFound(w, r) return } // Log the incoming webhook request h.log.Info("webhook request received", "entrypoint_uuid", entrypointUUID, "method", r.Method, "remote_addr", r.RemoteAddr, "user_agent", r.UserAgent(), ) // Only POST methods are allowed for webhooks if r.Method != http.MethodPost { w.Header().Set("Allow", "POST") http.Error(w, "Method not allowed", http.StatusMethodNotAllowed) return } // TODO: Implement webhook handling logic // Look up entrypoint by UUID, find parent webhook, fan out to targets w.WriteHeader(http.StatusNotFound) _, err := w.Write([]byte("unimplemented")) if err != nil { h.log.Error("failed to write response", "error", err) } } }