n8n-nodes-zalo-bot-stephen
v0.2.1
Published
n8n custom node for Zalo Bot Platform integration
Downloads
19
Maintainers
Readme
n8n-nodes-zalo-bot-stephen
Custom n8n nodes for integrating with Zalo Bot Platform.
Installation
Via npm
npm install n8n-nodes-zalo-bot-stephenInstall directly in n8n
- Go to Settings > Community Nodes
- Click "Install a community node"
- Enter:
n8n-nodes-zalo-bot-stephen - Click "Install"
Note: The package name is n8n-nodes-zalo-bot-stephen (not n8n-nodes-zalo-bot). Make sure to use the correct package name when installing.
Nodes
Zalo Bot Trigger
A webhook trigger node that starts your workflow when Zalo Bot receives a message.
Features:
- Automatically configures webhook URL when activated
- Validates incoming webhook requests using secret token
- Handles webhook lifecycle (add, check, remove)
- Two webhook modes:
- Default Webhook: Single output for all message types
- Smart Webhook: Intelligent routing to 5 different outputs based on message type
Webhook Modes:
Default Webhook
- Single output for all incoming messages
- Simple setup for basic workflows
- All message types routed to the same output
Smart Webhook (NEW!)
- 5 intelligent outputs for different message types:
- Text Message - Text-only messages
- Photo Only - Images without captions
- Photo + Message - Images with captions (perfect for e-commerce queries)
- Sticker - Sticker messages
- Unsupported/Other - Files, locations, and unsupported message types
- Automatic routing based on message content
- Perfect for complex workflows requiring different handling per message type
Configuration:
- Add your Zalo Bot API credentials
- Choose webhook mode (Default or Smart)
- The node will automatically set up the webhook when activated
- Incoming messages will trigger the workflow and route to appropriate outputs (Smart mode)
Zalo Bot
An action node for sending messages and interacting with Zalo Bot.
Resources:
- Message: Send text messages, photos, stickers, and chat actions
- Bot: Get bot information
- Webhook: Manage webhook configuration
Operations:
Message Operations
- Send Message: Send a text message to a chat
- Send Photo: Send a photo (supports URL or binary data)
- Send Sticker: Send a sticker by sticker ID
- Send Chat Action: Send typing indicators or upload status
Bot Operations
- Get Me: Get information about your bot
Webhook Operations
- Get Webhook Info: Get current webhook configuration
- Set Webhook: Configure webhook URL manually
- Delete Webhook: Remove webhook configuration
Credentials
Zalo Bot API
- Go to Zalo Bot Platform
- Create a bot and get your Bot Token
- Add the credential in n8n with your Bot Token
Usage Examples
Example 1: Simple Message Echo Bot (Default Webhook)
- Add Zalo Bot Trigger node (use Default webhook)
- Add Zalo Bot node
- Configure Zalo Bot node:
- Resource: Message
- Operation: Send Message
- Chat ID:
{{ $json.message.chat.id }} - Text:
{{ $json.message.text }}
Example 1b: Smart Routing Bot (Smart Webhook)
- Add Zalo Bot Trigger node (use Smart webhook)
- Connect different outputs to different workflows:
- Output 0 (Text): Connect to AI chatbot for text processing
- Output 1 (Photo Only): Connect to image storage (Google Drive, etc.)
- Output 2 (Photo + Message): Connect to e-commerce handler (process product queries with images)
- Output 3 (Sticker): Connect to sticker reply handler
- Output 4 (Unsupported): Connect to auto-reply: "Sorry, this format is not supported"
Example 2: E-commerce Bot with Smart Routing
- Add Zalo Bot Trigger node (Smart webhook)
- Connect Output 2 (Photo + Message) to:
- Extract caption text:
{{ $json.message.caption }} - Extract photo URL:
{{ $json.message.photo_url }} - Process product query with image
- Reply with product information
- Extract caption text:
- Connect Output 0 (Text) to:
- AI chatbot for general questions
- Connect Output 1 (Photo Only) to:
- Save image to storage
Example 3: Send Photo from URL
- Add Zalo Bot node
- Configure:
- Resource: Message
- Operation: Send Photo
- Chat ID:
123456789 - Photo:
https://example.com/image.jpg - Caption:
Check out this image!
Example 4: Send Photo from Binary Data
- Add a node that provides binary data (e.g., HTTP Request to download image)
- Add Zalo Bot node
- Configure:
- Resource: Message
- Operation: Send Photo
- Chat ID:
123456789 - Binary Data:
true - Binary Property:
data(or your binary property name) - Caption:
Image from workflow
Smart Webhook Routing Logic
The Smart Webhook automatically routes messages based on event_name and message content:
| Event Type | Condition | Output |
|------------|-----------|--------|
| message.text.received | Text message | Output 0: Text Message |
| message.image.received | Image with empty/null caption | Output 1: Photo Only |
| message.image.received | Image with caption text | Output 2: Photo + Message |
| message.sticker.received | Sticker message | Output 3: Sticker |
| message.unsupported.received | Unsupported type | Output 4: Unsupported/Other |
| Any other event | Fallback | Output 4: Unsupported/Other |
Message Structure:
{
"event_name": "message.image.received",
"message": {
"caption": "Mẫu này còn không?",
"photo_url": "https://...",
"chat": { "id": "..." },
"from": { "display_name": "..." }
}
}API Reference
For detailed API documentation, visit: Zalo Bot Platform Docs
Development
# Install dependencies
npm install
# Build
npm run build
# Lint
npm run lintLicense
MIT
Support
For issues and feature requests, please visit the GitHub repository.
Package Information
- Package Name:
n8n-nodes-zalo-bot-stephen - Current Version:
0.2.0 - npm Registry: https://www.npmjs.com/package/n8n-nodes-zalo-bot-stephen
