zalo-v1

n8n node for Zalo automation

Documentation

n8n-nodes-zalo-v1

This is an n8n community node that allows you to interact with Zalo messaging platform in your n8n workflows.

n8n is a fair-code licensed workflow automation platform.

Installation

Follow the installation guide in the n8n community nodes documentation.

Community Node Installation

  1. Go to Settings > Community Nodes
  2. Select Install
  3. Enter n8n-nodes-zalo-v1 in the Enter npm package name field
  4. Agree to the risks and select Install

Troubleshooting: "The specified package could not be loaded"

If you encounter this error, it's a known n8n issue with stale files. Fix it by running:

./fix-n8n-install.sh

Or manually:

# Stop n8n
docker stop <your-n8n-container>

# Clear nodes directory
docker exec <container> rm -rf /home/node/.n8n/nodes/*

# Start n8n
docker start <your-n8n-container>

# Then install via n8n UI again

See TROUBLESHOOTING.md for more details.

Manual Installation

To install the node locally for development:

# Clone the repository
git clone https://github.com/TechxnixLLC/n8n-nodes-zalo-v1.git
cd n8n-nodes-zalo-v1

# Install dependencies
npm install

# Build the node
npm run build

# Link the node to n8n
npm link
cd ~/.n8n/nodes
npm link n8n-nodes-zalo-v1

Features

Main Node: Zalo User

The Zalo User node supports the following operations:

Message Resource

  • Send Message - Send text messages to users or groups
  • Send Sticker - Send stickers
  • Send Image - Send images
  • Send Link - Share links

Friend Resource

  • Send Friend Request - Send friend requests
  • Accept Friend Request - Accept incoming friend requests
  • Get All Friends - Retrieve list of all friends
  • Block User - Block specific users

Group Resource

  • Create Group - Create new groups
  • Add User to Group - Add users to existing groups
  • Remove User from Group - Remove users from groups
  • Change Group Name - Update group names
  • Create Poll - Create polls in groups

Get Resource

  • Get All Friends - Get list of friends
  • Get All Groups - Get list of groups
  • Get User Info - Get information about specific users
  • Get Last Message - Retrieve last message from a thread

Trigger Node: Zalo User Trigger

The trigger node listens for real-time events:

  • New Message - Trigger on new messages
  • Friend Request - Trigger on friend requests
  • Group Event - Trigger on group events
  • All Events - Trigger on any Zalo event

Filter Options

  • Filter by specific user IDs
  • Filter by specific group IDs
  • Keyword filtering
  • Option to exclude self messages

Credentials

To use this node, you need to set up Zalo User API credentials:

Authentication Methods

  1. QR Code (Recommended for first-time setup)

    • Scan QR code with Zalo mobile app
  2. Cookie (For automated workflows)

    • Extract cookie from browser after logging into Zalo Web
    • Open browser console and run: document.cookie
    • Copy the entire cookie string

Required Fields

  • Authentication Method: Choose QR Code or Cookie
  • Cookie: Your Zalo session cookie (if using Cookie method)
  • IMEI: Device identifier (optional, auto-generated if not provided)
  • User Agent: Browser user agent string

Usage Example

Send a Message Workflow

  1. Add the Zalo User node to your workflow
  2. Select Message as the resource
  3. Choose Send Message operation
  4. Enter the recipient's Thread ID
  5. Select Thread Type (User or Group)
  6. Enter your Message text
  7. Execute the node

Listen for New Messages

  1. Add the Zalo User Trigger node
  2. Select New Message as event type
  3. Set polling interval (default: 5 seconds)
  4. Optionally configure filters
  5. Activate the workflow

Important Notes

⚠️ Placeholder Implementation

This is a template/starter implementation with placeholder responses. To make it fully functional, you need to:

  1. Integrate with actual Zalo API:

    • Use official Zalo API from https://developers.zalo.me
    • Or integrate with libraries like zalo-api-final
    • Or implement browser automation
  2. Replace placeholder responses in:

    • nodes/ZaloUser/ZaloUser.node.ts
    • nodes/ZaloUser/ZaloUserTrigger.node.ts
  3. Implement real authentication in credentials

QR Login Node

The package includes a dedicated Zalo Login node that handles authentication:

  • Login with QR Code - Displays QR code in terminal for scanning
  • Login with Cookies - Authenticate using existing credentials
  • Validate Credentials - Check if session is still valid

Uses the zca-js library (v2.0.4) for lightweight, reliable Zalo API access without requiring a browser.

API Integration Options

Option A: zca-js (Recommended - Already Included)

npm install zca-js

Lightweight Zalo API wrapper with built-in authentication. See: https://www.npmjs.com/package/zca-js

Option B: Official Zalo API

npm install axios

Register your app at https://developers.zalo.me and use OAuth tokens.

Option C: Community Libraries

npm install zalo-api-final

Use community-maintained Zalo libraries.

Development

Build the project

npm run build

Watch mode for development

npm run dev

Lint the code

npm run lint
npm run lintfix

Format the code

npm run format

Resources

License

MIT

Support

For issues and questions:

Version History

0.1.0

  • Initial release
  • Basic node structure with placeholder implementations
  • Support for Message, Friend, Group, and Get resources
  • Trigger node for real-time events
  • Zalo Login node with QR code authentication
  • zca-js integration for reliable API access
  • Cookie and credential-based authentication methods

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Discussion