diff --git a/pkg/handlers/static/index.html b/pkg/handlers/static/index.html index 65474d9..e6e6a35 100644 --- a/pkg/handlers/static/index.html +++ b/pkg/handlers/static/index.html @@ -131,65 +131,6 @@ color: #666; } - .endpoints { - background: #f8f9fa; - border-radius: 10px; - padding: 30px; - text-align: left; - animation: fadeInUp 0.8s ease 1s both; - } - - .endpoints h2 { - color: #1a237e; - margin-bottom: 20px; - text-align: center; - } - - .endpoint-group { - margin-bottom: 20px; - } - - .endpoint-group h3 { - color: #1e88e5; - font-size: 1em; - margin-bottom: 10px; - } - - .endpoint { - background: white; - padding: 12px 15px; - margin-bottom: 8px; - border-radius: 6px; - font-family: 'Monaco', 'Courier New', monospace; - font-size: 0.85em; - display: flex; - align-items: center; - gap: 10px; - } - - .endpoint-method { - background: #1e88e5; - color: white; - padding: 4px 8px; - border-radius: 4px; - font-weight: 600; - font-size: 0.85em; - min-width: 60px; - text-align: center; - } - - .endpoint-method.post { - background: #4caf50; - } - - .endpoint-method.delete { - background: #f44336; - } - - .endpoint-path { - color: #666; - } - .footer { margin-top: 40px; padding-top: 30px; @@ -265,11 +206,6 @@ width: 150px; height: 150px; } - - .endpoint { - flex-direction: column; - align-items: flex-start; - } } @@ -311,258 +247,6 @@ -
Need help? Check out the documentation · Privacy Policy · Terms of Service
Made by Warky Devs
diff --git a/pkg/hooks/manager.go b/pkg/hooks/manager.go index e7fd0d6..6a1536c 100644 --- a/pkg/hooks/manager.go +++ b/pkg/hooks/manager.go @@ -390,7 +390,11 @@ func (m *Manager) sendToHook(ctx context.Context, hook config.Hook, payload inte } parsedURL.RawQuery = query.Encode() - req, err := http.NewRequestWithContext(hookCtx, hook.Method, parsedURL.String(), bytes.NewReader(data)) + method := hook.Method + if method == "" { + method = http.MethodPost + } + req, err := http.NewRequestWithContext(hookCtx, method, parsedURL.String(), bytes.NewReader(data)) if err != nil { logging.Error("Failed to create request", "hook_id", hook.ID, "error", err) m.eventBus.Publish(events.HookFailedEvent(eventCtx, hook.ID, hook.Name, err)) @@ -413,8 +417,14 @@ func (m *Manager) sendToHook(ctx context.Context, hook config.Hook, payload inte defer resp.Body.Close() if resp.StatusCode < 200 || resp.StatusCode >= 300 { - logging.Warn("Hook returned non-success status", "hook_id", hook.ID, "status", resp.StatusCode) - m.eventBus.Publish(events.HookFailedEvent(eventCtx, hook.ID, hook.Name, fmt.Errorf("status code %d", resp.StatusCode))) + errBody, _ := io.ReadAll(resp.Body) + logging.Warn("Hook returned non-success status", + "hook_id", hook.ID, + "status", resp.StatusCode, + "status_text", resp.Status, + "body", string(errBody), + ) + m.eventBus.Publish(events.HookFailedEvent(eventCtx, hook.ID, hook.Name, fmt.Errorf("%s: %s", resp.Status, string(errBody)))) return nil } diff --git a/pkg/serverembed/dist/api.json b/pkg/serverembed/dist/api.json new file mode 100644 index 0000000..1e09d2d --- /dev/null +++ b/pkg/serverembed/dist/api.json @@ -0,0 +1,1704 @@ +{ + "openapi": "3.1.0", + "info": { + "title": "WhatsHooked API", + "version": "1.0.0", + "description": "WhatsApp webhook bridge API. Supports whatsmeow (WhatsApp Web) and Meta WhatsApp Business API accounts.\n\n**Authentication** — supply one of:\n- `x-api-key: