# Zalo Channel Adapter Checklist

**Date:** 2026-02-16  
**Scope:** Implement Zalo adapter to close the remaining channel gap in the LINE/Feishu/Zalo set.

## Goal

Add a Zalo OA channel adapter with webhook ingress, outbound send path, mention/allowlist gating, and runtime wiring through daemon + gateway.

## Implemented

- Added Zalo adapter:
  - `src/channels/zalo/adapter.ts`
  - `src/channels/zalo/index.ts`
- Inbound webhook handling:
  - endpoint: `POST /zalo/events`
  - optional webhook token validation (`x-zalo-token` header or payload token)
- Message normalization:
  - sender/message extraction and normalized `InboundMessage` emission
  - mention gating (`require_mention`, `mention_name`)
  - optional user allowlist (`allowed_user_ids`)
- Outbound send:
  - OA CS text message API call with `oa_access_token`
- Runtime integration:
  - config schema for `zalo` block
  - daemon registration + gateway handler binding
  - service discovery listing

## Tests

- `src/channels/zalo/adapter.test.ts`
  - name/status
  - outbound send path
  - inbound normalization
  - webhook token enforcement
  - mention gating behavior
- `src/daemon/channels.test.ts`
  - adapter registration + gateway `setZaloHandler` wiring
- `src/config/schema.test.ts`
  - zalo config parse/defaults
- `src/gateway/handlers/services.test.ts`
  - `zalo` service visibility

## Validation Run

```bash
pnpm test:run src/channels/zalo/adapter.test.ts src/daemon/channels.test.ts src/config/schema.test.ts src/gateway/handlers/services.test.ts
pnpm typecheck
pnpm build
```
