Appearance
System overview
AW Chat is a custom in-app support stack. Clients never talk to Intercom directly: they call your @aw-chat/server, which owns secrets, storage, and fan-out to Intercom / push providers.
Topology
┌─────────────────┐ ┌─────────────────┐
│ Host app (web) │ │ Host app (RN) │
│ @aw-chat/web │ │ @aw-chat/rn │
└────────┬────────┘ └────────┬────────┘
│ HTTP + polling │
└───────────┬───────────┘
▼
@aw-chat/server
┌───────────┼───────────┐
▼ ▼ ▼
Intercom PostgreSQL S3
(chat/tickets (channel, (file
contacts) comments, bytes)
CSAT, …)
│
├── FCM / Telegram (push)
└── Admin SPA ──▶ /admin/*| Component | Package / path | Role |
|---|---|---|
| Web / TMA SDK | @aw-chat/web | DOM UI; polls the backend |
| React Native SDK | @aw-chat/react-native | Native UI (no WebView) |
| Shared client | @aw-chat/core | Types, ApiClient, polling helpers |
| API | @aw-chat/server | Hono + Drizzle; Intercom adapter |
| Admin panel | @aw-chat/admin | Vite SPA for operators / authors |
| Docs | @aw-chat/docs | This VitePress site |
Critical design rules
- Clients never call Intercom. Access tokens stay on the server.
- No WebSocket / SSE. Delivery is HTTP polling (default ~4s). See Limitations.
- Two product surfaces, two stores. Support chat/tickets live in Intercom. AW Channel posts and comments live in Postgres. Details in Data model.
- CSAT and complaints are first-class in Postgres (admin panel), with best-effort Intercom notes/tags.
- One-line host integration. Mount
<AWChat />with props; mint the JWT on your backend.
Request flows (high level)
Support message
- Host mints JWT → SDK
POST /api/conversations(or reply). - Server resolves
userId→ Intercom contact (user_contactscache). - Message + attachment URLs written via Intercom REST.
- Operator replies in Intercom → webhook
POST /webhooks/intercom. - Server invalidates cache, may send push; SDK picks up on next poll.
Channel comment
- SDK
POST /api/channel/:id/posts/:postId/comments(body + optional image). - Server enforces DLP / link guard / rate limit → row in
channel_comments. - Other clients see it on comment poll (~5s while the thread is open).
- Moderation is Postgres + admin APIs (not Intercom).
Channel post publish
- Admin authors in
@aw-chat/admin→ Postgreschannel_posts(+ S3 media). - Publish / schedule job marks the post live.
- Optional push to devices with channel notifications enabled.
- SDK channel feed poll shows the post.
Where to go next
| Audience | Start here |
|---|---|
| App integrators | Quick start → Auth → Props |
| Platform / SRE | Data model → Configuration → Deployment |
| Security review | Security |
| Day-2 ops | Operations |