FakeMessagePlatform
A programmable fake message platform for GoChat automated integration testing.
What it does
FakeMessagePlatform simulates an external messaging channel. It:
- Sends messages to GoChat's
/webhooks/fake/:identifierwebhook endpoint (simulating customer-initiated messages) - Receives GoChat's outbound messages at
/receive(messages sent by agents via FakeProvider.SendMessage) - Tracks all sent/received messages and agent states in memory for test assertions
- Provides REST API for test scripts to orchestrate message flows
Quick start
# From repo root
pnpm install
pnpm fake:start
# Health check
curl http://127.0.0.1:9100/health
# → {"status":"ok","service":"fake-message-platform"}
Configuration
Environment variables:
| Variable | Default | Description |
|---|---|---|
PORT |
9100 |
HTTP listen port |
GOCHAT_WEBHOOK_URL |
http://127.0.0.1:3000/webhooks/fake/fake_inbox_1 |
GoChat webhook URL |
GOCHAT_FAKE_TOKEN |
(empty) |
X-Fake-Token shared secret |
REST API
| Method | Path | Description |
|---|---|---|
POST |
/api/send |
Send a message to GoChat (simulate customer) |
POST |
/api/reply |
Reply to a message (simulate customer reply) |
POST |
/api/close |
Close a chat session (session.end event) |
POST |
/api/typing |
Toggle typing indicator |
POST |
/api/agent/online |
Mark an agent as online |
POST |
/api/agent/offline |
Mark an agent as offline |
GET |
/api/messages |
Query outbound messages received from GoChat |
GET |
/api/messages/:id |
Query a single message |
GET |
/api/status |
Platform status (agents, counts) |
POST |
/api/reset |
Reset all in-memory state |
POST |
/receive |
Receive GoChat outbound message |
GET |
/health |
Health check |
Message flow
Test script → FakeMessagePlatform → GoChat webhook → Broker → Pipeline → DB → WS push
↑
Agent reply → FakeProvider.SendMessage → POST /receive → FakeMessagePlatform store
Related
- GoChat FakeProvider:
backend/internal/channel/provider/fake.go - GoChat FakeWebhookHandler:
backend/internal/handler/webhook/fake_webhook.go - Test plan:
docs/qa/2026-07-09-test-plan-round5.md