ZaloClaw

ZaloMessagingZaloclawZca Js

OpenClaw channel plugin for Zalo personal accounts via zca-js

Install

openclaw plugins install clawhub:zaloclaw

🦞 zaloclaw

Unofficial OpenClaw plugin — Zalo Personal Account Channel

Connect your personal Zalo account to an AI agent with 147 full-featured actions.

CI npm License: MIT ClawHub OpenClaw Node.js

EN: Install · VI: Cài đặt · Tính năng · 147 Actions · 💬 Community


⚠️ Disclaimer — Dự án không chính thức

Dự án này không có liên kết, không được phê duyệt và không được tài trợ bởi Zalo hoặc VNG Corporation.

Zalo không cung cấp API chính thức cho tài khoản cá nhân và không cho phép tự động hóa tài khoản cá nhân theo Điều khoản dịch vụ. Plugin hoạt động thông qua thư viện reverse-engineered zca-jscó thể vi phạm ToS Zalo, dẫn đến tài khoản bị khóa hoặc đình chỉ.

Được cung cấp "as-is" cho mục đích nghiên cứu và tự động hóa cá nhân. Người dùng tự chịu toàn bộ rủi ro.


Install

⚠️ Disclaimer: This project is not affiliated with, endorsed by, or sponsored by Zalo or VNG Corporation. Zalo does not provide an official API for personal accounts and does not permit automation of personal accounts. This plugin uses the reverse-engineered zca-js library and may violate Zalo’s Terms of Service, potentially leading to account suspension. Use at your own risk.

Requirements: OpenClaw ≥ 2026.2.0 · Node.js ≥ 22 · Personal Zalo account (not OA)


Option A — ClawHub (recommended)

# 1. Install
openclaw plugins install clawhub:zaloclaw

# 2. Restart gateway
openclaw gateway restart

# 3. Login via QR
openclaw channels login --channel zaloclaw

A QR code appears in the terminal. Open your Zalo app → Personal page → QR icon and scan it.

After a successful scan:

openclaw status
# Look for: ZaloClaw ✔  ON  connected

Option B — npm

# 1. Install
openclaw plugins install zaloclaw

# 2. Restart gateway
openclaw gateway restart

# 3. Login via QR
openclaw channels login --channel zaloclaw

Same QR flow as Option A.


Option C — Manual clone

# 1. Clone
git clone https://github.com/monas-team/zaloclaw.git ~/zaloclaw
cd ~/zaloclaw
npm install          # install runtime dependencies
                     # (no build needed — dist/ is pre-built)

# 2. Register with OpenClaw  ← required before channels login
openclaw plugins install --link ~/zaloclaw

# 3. Restart gateway
openclaw gateway restart

# 4. Login via QR
openclaw channels login --channel zaloclaw

channels login not working? If you see Unsupported channel "zaloclaw", run openclaw setup instead — same QR flow, compatible with all OpenClaw versions. This happens when the plugin was not registered via openclaw plugins install.

Session expired? Re-run openclaw channels login --channel zaloclaw and scan a new QR code.

Features at a glance

CategoryHighlights
💬 MessagingText, rich text, images, files, video, voice, stickers, link preview
👥 GroupsCreate/manage groups, admins, polls, reminders, invite links
🤝 FriendsFind, add, block, nicknames, online status
🤖 AI-nativeMention gating, image buffering, quote context, typing indicator
🔐 Access controlDM policy, group policy, per-user allow/deny lists
⚙️ AutomationAuto-reply, quick messages, auto-unsend, read receipts

Full 147-action reference: docs/agent-help.md


Tại sao zaloclaw?

Zalo (~75 triệu người dùng tại Việt Nam) không có API bot cho tài khoản cá nhân — chỉ có Zalo OA dành cho doanh nghiệp với nhiều hạn chế. ZaloClaw lấp khoảng trống đó bằng cách bridge tài khoản Zalo cá nhân với OpenClaw, cho phép hội thoại AI và tự động hóa toàn diện qua Zalo.


Cài đặt

Yêu cầu: OpenClaw ≥ 2026.2.0 · Node.js ≥ 22 · Tài khoản Zalo cá nhân (không phải OA)


Cách 1 — ClawHub (khuyến nghị)

# 1. Cài plugin
openclaw plugins install clawhub:zaloclaw

# 2. Khởi động lại gateway
openclaw gateway restart

# 3. Đăng nhập bằng QR
openclaw channels login --channel zaloclaw

Mã QR hiện ngay trên terminal. Mở Zalo app → Trang cá nhân → icon QR rồi quét.

Sau khi quét thành công:

openclaw status
# ZaloClaw ✔  ON  connected

Cách 2 — npm

# 1. Cài plugin
openclaw plugins install zaloclaw

# 2. Khởi động lại gateway
openclaw gateway restart

# 3. Đăng nhập bằng QR
openclaw channels login --channel zaloclaw

QR flow giống Cách 1.


Cách 3 — Clone thủ công

# 1. Clone và cài dependency
git clone https://github.com/monas-team/zaloclaw.git ~/zaloclaw
cd ~/zaloclaw
npm install          # cài runtime deps (không cần build — dist/ đã có sẵn)

# 2. Đăng ký với OpenClaw  ← bắt buộc trước channels login
openclaw plugins install --link ~/zaloclaw

# 3. Khởi động lại gateway
openclaw gateway restart

# 4. Đăng nhập bằng QR
openclaw channels login --channel zaloclaw

Lỗi channels login? Nếu gặp Unsupported channel "zaloclaw", chạy openclaw setup thay thế — cùng luồng QR, tương thích mọi phiên bản. Nguyên nhân: plugin chưa được đăng ký qua openclaw plugins install.

Session hết hạn? Chạy lại openclaw channels login --channel zaloclaw và quét QR mới.


Tính năng

Danh mụcHighlights
💬 Nhắn tinText, rich text, ảnh, file, video, voice, sticker, link preview
👥 NhómTạo/quản lý nhóm, admin, bình chọn, nhắc nhở, link mời
🤝 Bạn bèTìm, kết bạn, chặn, biệt danh, trạng thái online
🤖 AI-nativeMention gating, image buffering, quote context, typing indicator
🔐 Kiểm soátDM policy, group policy, allowlist/blocklist theo user/nhóm
⚙️ Cài đặtAuto-reply, quick messages, auto-unsend, read receipt

Chi tiết nổi bật

  • Mention gating — Bot chỉ phản hồi khi được @mention trong nhóm; có thể tắt per-group
  • Image buffering — Nhớ ảnh từ tin nhắn không mention, dùng làm context khi được @tag sau
  • Rich text — Markdown tự chuyển sang bold/italic/gạch chân/màu sắc Zalo
  • Urgency levels1 = quan trọng 🔶, 2 = khẩn cấp 🔴
  • Quote reply — AI nhận đầy đủ context tin nhắn được trích dẫn + người gửi

Cấu hình

File: ~/.openclaw/openclaw.json → key channels.zaloclaw

{
  "channels": {
    "zaloclaw": {
      "accounts": {
        "default": {
          "enabled": true,

          // Chính sách DM: open | pairing | allowlist | disabled
          "dmPolicy": "open",
          "allowFrom": ["*"],
          "denyFrom": [],

          // Chính sách nhóm: open | allowlist | disabled
          "groupPolicy": "open",

          // Override theo từng nhóm (dùng group ID hoặc "*" cho mặc định)
          "groups": {
            "*":          { "requireMention": true },
            "<group_id>": { "allow": true, "requireMention": false }
          }
        }
      }
    }
  }
}

DM Policy

PolicyHành vi
openChấp nhận tất cả DM
pairingYêu cầu trao đổi mã với người dùng lạ
allowlistChỉ user trong allowFrom
disabledChặn tất cả DM

147 Actions

Plugin expose một tool zaloclaw duy nhất với 147 actions. Tên người dùng và tên nhóm tự động resolve thành Zalo numeric ID. Xem đầy đủ tại docs/agent-help.md.

💬 Nhắn tin — 16 actions
ActionMô tả
sendGửi text (urgency 0/1/2, messageTtl)
send-styledRich text: bold, italic, gạch chân, gạch ngang, màu
send-imageẢnh qua URL hoặc local path
send-fileFile bất kỳ (PDF, doc, zip…) qua URL hoặc local path
send-videoVideo
send-voiceTin nhắn thoại
send-linkURL kèm preview tự động
send-stickerSticker theo ID hoặc keyword
send-cardDanh thiếp liên hệ
send-bank-cardThông tin thẻ ngân hàng
send-typingChỉ báo đang nhập
send-to-strangerNhắn người chưa kết bạn
forward-messageChuyển tiếp đến nhiều hội thoại (hỗ trợ TTL)
delete-messageXóa tin nhắn
undo-messageThu hồi tin nhắn đã gửi
add-reactionReact: heart · like · haha · wow · cry · angry
🤝 Bạn bè — 16 actions
ActionMô tả
friendsDanh sách bạn bè (filter/search)
find-userTìm theo số điện thoại
find-user-by-usernameTìm theo username Zalo
send-friend-requestGửi lời mời kết bạn
accept-friend-requestChấp nhận lời mời
reject-friend-requestTừ chối lời mời
get-friend-requestsLời mời đang chờ
get-sent-requestsLời mời đã gửi
undo-friend-requestHủy lời mời đã gửi
unfriendXóa bạn
check-friend-statusTrạng thái kết bạn / lời mời
set-friend-nicknameĐặt biệt danh
remove-friend-nicknameXóa biệt danh
get-online-friendsBạn bè đang online
get-close-friendsBạn thân
get-friend-recommendationsGợi ý kết bạn
👥 Nhóm — 22 actions
ActionMô tả
groupsDanh sách nhóm (có search)
get-group-infoChi tiết nhóm
create-groupTạo nhóm mới
add-to-groupThêm thành viên
remove-from-groupXóa thành viên
leave-groupRời nhóm
rename-groupĐổi tên nhóm
add-group-admin / remove-group-adminQuản lý admin
change-group-ownerChuyển quyền trưởng nhóm
disperse-groupGiải tán nhóm
update-group-settingsCài đặt (lịch sử, duyệt tham gia, khóa tên…)
enable/disable/get-group-linkQuản lý link mời nhóm
get/review-pending-membersDuyệt yêu cầu tham gia
block/unblock-group-memberChặn thành viên
get-group-members-infoChi tiết thành viên
change-group-avatarĐổi avatar nhóm
upgrade-group-to-communityNâng cấp thành cộng đồng
get-group-chat-historyLịch sử tin nhắn
📊 Bình chọn — 6 actions

create-poll · vote-poll · lock-poll · get-poll-detail · add-poll-options · share-poll

Hỗ trợ: đa lựa chọn, thêm tùy chọn mới, ẩn danh, thời hạn tùy chỉnh.

🔔 Nhắc nhở — 6 actions

create-reminder · edit-reminder · remove-reminder · list-reminders · get-reminder · get-reminder-responses

💼 Hội thoại, Tự động trả lời, Hồ sơ, Sản phẩm — 51 actions

Quản lý hội thoại (16): Mute/unmute, pin/unpin, ẩn/hiện, tự xóa (1/7/14 ngày), lưu trữ, đánh dấu chưa đọc.

Tin nhắn nhanh & Auto-reply (8): CRUD quick messages + auto-reply rules (phạm vi: tất cả / người lạ / bạn bè cụ thể).

Hồ sơ & Tài khoản (14): me, update-profile, change-avatar, get-qr, last-online, get-biz-account, quản lý lịch sử avatar, v.v.

Danh mục & Sản phẩm (8): CRUD catalog và product — dành cho tài khoản shop/doanh nghiệp.

Tiện ích & Cài đặt (5): get/update-settings, update-active-status, parse-link, search-stickers, tra cứu hàng loạt SĐT.

🔧 Quản lý Bot — OpenClaw layer — 13 actions

Block/unblock user toàn cục và theo nhóm, allowlist, require-mention config per-group, trust management.


Kiến trúc

zaloclaw/
├── index.ts                    ← Entry point & tool registration
├── src/
│   ├── channel/
│   │   ├── channel.ts          ← Plugin lifecycle (start / stop / dock)
│   │   ├── monitor.ts          ← Inbound router & access control
│   │   ├── send.ts             ← Outbound dispatcher & markdown converter
│   │   ├── onboarding.ts       ← QR login flow
│   │   └── image-downloader.ts ← Media handler
│   ├── client/
│   │   ├── zalo-client.ts      ← zca-js wrapper (login, getApi, reconnect)
│   │   ├── credentials.ts      ← Credential persistence
│   │   └── accounts.ts         ← Multi-account resolver
│   ├── config/                 ← Schema validation & runtime config
│   ├── tools/tool.ts           ← 147 action handlers
│   └── features/               ← sticker · quote-reply · reaction-ack · …
└── docs/
    ├── agent-help.md           ← Full 147-action reference
    └── agent-install.md        ← Install guide

Message flow:

Zalo WS → zca-js → monitor.ts
                       │
                       ├─ Access control (block/allow/policy)
                       ├─ Mention gate  (skip → buffer image)
                       ├─ Media download
                       ├─ Context build (sender · quote · media)
                       └─ OpenClaw agent → send.ts → Zalo

Phát triển

npm run typecheck          # TypeScript check
npm run test               # Vitest test suite
npm run build              # esbuild → dist/index.js

# Dev — link trực tiếp, không cần build lại
openclaw plugins install --link .
openclaw gateway restart

Thêm action mới: Handler trong src/tools/tool.ts → wire vào monitor.ts / send.ts nếu cần → typecheck → restart.


Hạn chế đã biết

Mức độVấn đềChi tiết
🔴Unofficial APIReverse-engineered client — có thể break khi Zalo cập nhật protocol
🟡SessionCookie có thể hết hạn — cần quét lại QR để khôi phục
🟡Rate limitGửi quá nhiều có thể bị Zalo throttle hoặc block tài khoản
🟡Đa tài khoảnHỗ trợ về kiến trúc nhưng chưa kiểm thử đầy đủ
🟢StreamingTắt theo thiết kế (blockStreaming: true)
🟢Message TTLServer Zalo có thể không áp dụng — dùng set-auto-delete-chat thay thế

Ủng hộ đồng bào 🇻🇳

Nếu ZaloClaw có ích với bạn, hãy cân nhắc đóng góp cho Quỹ Cứu trợ Trung ương — Ủy ban MTTQ Việt Nam để hỗ trợ đồng bào bị thiên tai, lũ lụt.

Ngân hàngSố tài khoảnTên tài khoảnChi nhánhQR
Vietcombank666.666.1010Ủy ban TW MTTQ Việt NamHà NộiQR
VietinBank55102025Ban Vận động Cứu trợ TWQR
BIDV1200979797Ủy ban TW MTTQ Việt NamSở Giao dịch 1QR

⚠️ MTTQ đã cảnh báo về nhiều tài khoản giả mạo — chỉ chuyển vào 3 STK trên. Nguồn chính thức: mattran.org.vn


Giấy phép

MIT © monas-team


Dự án này không có liên kết với Zalo hay VNG Corporation. "Zalo" là thương hiệu thuộc sở hữu của VNG Corporation.