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) - Automatically echoes agent messages back to GoChat as the same customer, so reply flows can be tested from the dashboard
- 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 |
FAKE_AUTO_REPLY |
true |
Echo human-agent outbound messages back as customer messages |
FAKE_AUTO_REPLY_DELAY_MS |
250 |
Delay before sending the automatic echo reply |
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
↓
Customer echo ← GoChat fake webhook ← automatic same-content reply
Automatic replies use the outbound message's recipient identity, so the echoed
message is appended to the same open customer conversation. Bot/system sender
types are ignored to prevent automation loops. Set FAKE_AUTO_REPLY=false to
restore record-only behavior.
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