How chickenai/zalo-node works
Project type and purpose
• This is an n8n community node plugin that embeds itself into an existing n8n instance.
• It provides automations for Zalo Web by simulating a browser session, exposing actions (send message, group management, user management, message triggers) as n8n nodes.
• No standalone frontend or backend service; it runs inside the n8n host process.
File structure
Top‑level:
• credentials/ – TypeScript files defining credential schemas (N8nApi, ZaloApi).
• nodes/ – One folder per node, each with .node.ts (runtime logic) and optional Description files (*.node.ts, *Description.ts).
– ZaloLoginByQR, ZaloGroup, ZaloMessageTrigger, ZaloSendMessage, ZaloUser
• index.js – Entry point that registers all nodes and credentials with n8n.
• gulpfile.js – Build script to transpile TS to JS.
• tsconfig.json, package.json, lockfiles, linters, and editor configs.
README for insights
• Describes each node’s operations and event triggers.
• Emphasizes the in‑process nature (no external APIs beyond Zalo Web).
• Mentions dependency on a browser‑automation library (ZCA‑JS).
Main components and interactions
a. n8n Host (core runtime & UI)
b. Node Plugin
• Index – orchestrates registration of credentials and nodes.
• Credentials Module – defines how Zalo login tokens are stored and retrieved.
• Node Modules (ZaloLoginByQR, ZaloGroup, ZaloUser, ZaloSendMessage, ZaloMessageTrigger)
• Each node has:
– Description (metadata for the n8n editor)
– Node Class (execute() logic)
• Build Tools – Gulp for transpilation
c. Browser‑Automation Engine (ZCA‑JS, likely wraps Puppeteer/Playwright)
• Simulates a Chromium session to interact with Zalo Web UI.
d. Zalo Web
• The external service being automated.
Relationships:
1. n8n Workflow invokes a Node instance.
2. Node code uses stored ZaloApi credentials to instantiate a headless browser session via ZCA‑JS.
3. Browser session navigates to Zalo Web, executes actions (click, type, read DOM).
4. Results return to the Node’s execute() method and propagate back into the workflow.
Architectural patterns and design principles
• Plugin architecture: Clear separation between host (n8n) and extension (this module).
• Modular Nodes: Each feature encapsulated as an individual node following n8n’s Node interface.
• Credential abstraction: Central credential management reused by multiple nodes.
• Browser automation as a service: All nodes share a browser session handler.