GOWA - WhatsApp REST API with support for UI, Multi Account, Webhooks, and MCP, and Chatwoot. Built with Golang for efficient memory use.
Go botgogolanggolang-whatsappgolang-whatsapp-apirestrest-apiwhatsappwhatsapp-apiwhatsapp-api-gowhatsapp-multi-devicewhatsapp-web-multi-device
Transport adapters
rest/, mcp/, and websocket/ parse transport inputs and delegate to domain
usecases. REST and MCP share the rest process and device manager.
REST and websockets
rest/<domain>.goregisters routes withInitRest*. Parse bodies/files and use the existingutils.ResponseDatasuccess envelope (Status: 200,Code: "SUCCESS").- Device operations belong behind
DeviceMiddleware; management routes sit outside it. Passwhatsapp.ContextWithDevice(c.Context(), getDeviceFromCtx(c))to device-bound usecases. Browser websockets select a device with?device_id=. - Route/auth order lives in
../cmd/rest.go. Chatwoot webhooks are mounted before Basic Auth and reject calls when the effective secret is empty, unlessCHATWOOT_WEBHOOK_ALLOW_UNSIGNEDis set. A device config's ownwebhook_secretreplaces it for that device on both endpoints: callchatwootWebhookRouteGatewith the final route before acting on a webhook. MountChatwootWebhookReplayGuardin front of the webhook routes: it remembers a signed request only once the whole handler chain answered 2xx, so answer non-2xx for a delivery that must be sent again. Keep manual sync/config routes authenticated and preserve webhook device routing and echo guards. New public routes need an explicit public contract, such as a health check or webhook.
MCP
mcp/<domain>.godefines tools/handlers and registers them viaAdd*Tools. The consolidatedwhatsapp_send,whatsapp_schedule,whatsapp_message,whatsapp_chat,whatsapp_group, andwhatsapp_apptools dispatch ontypeoraction. MCP send arguments cover a subset of REST DTOs; validate types and preserve result formats.- Resolve device-bound calls with
resolveDeviceContextinmcp/device.go: explicitdevice_idoverrides the device injected bymcp/route.gofromX-Device-Id. An empty header may resolve the default/only device at the HTTP layer. If no device reaches the tool, resolution returns an error. - Keep streaming disabled in the Fiber adaptor: an idle GET SSE connection can
retain a goroutine/connection until shutdown.
mcp/route.gomounts POST and DELETE. - For authentication changes, read MCP OAuth and
../cmd/mcp_oauth.go. OAuth-protected MCP mounts before global Basic Auth; when OAuth is disabled, MCP uses the ordinary authenticated router.
Use the relevant handler tests, Fiber's app.Test, or MCP tool tests for changed
routing, auth, parsing, and device resolution behavior.