n8n-nodes-routeros-middleware
v1.1.6
Published
n8n node for interacting with MikroTik RouterOS via Middleware Service
Maintainers
Readme
n8n-nodes-routeros-middleware
Custom n8n node for interacting with MikroTik RouterOS devices via the MikroTik Billing Automation Middleware.
Features
- Change PPP Profile: Automatically switch user profiles (e.g., for billing automation - isolir/restore)
- Enable/Disable Users: Enable or disable PPPoE users
- Force Reconnect: Force users to reconnect (useful after profile changes)
- Get Active Sessions: Retrieve all active PPPoE sessions
- Test Connection: Verify connectivity to MikroTik routers
Installation
Option 1: Community Nodes Store (Recommended)
- In your n8n instance, go to Settings → Community Nodes
- Click Add and search for
n8n-nodes-routeros-middleware - Click Install
Option 2: Manual Installation
cd ~/.n8n
npm install n8n-nodes-routeros-middlewareThen restart n8n.
Configuration
Credentials
This node requires API credentials for the MikroTik Middleware Service:
- Base URL: The URL where your middleware service is running (e.g.,
http://localhost:3000) - API Key: The API key from your middleware service (defined in the
.envfile)
Usage Examples
1. Automated Billing Isolation
When a customer hasn't paid, automatically move them to an isolated profile:
Trigger: Billing System Webhook (Overdue Payment)
↓
Mikrotik Node: Change Profile
- Username: {{ $json.customer_username }}
- Router Name: main-router
- New Profile: ISOLIR-256K
- Force Reconnect: true
↓
WhatsApp Node: Send Payment Reminder2. Payment Restoration
When payment is received, restore the customer's internet:
Trigger: Payment Gateway Webhook (Payment Success)
↓
Mikrotik Node: Change Profile
- Username: {{ $json.customer_username }}
- Router Name: main-router
- New Profile: HOME-20MB
- Force Reconnect: true
↓
WhatsApp Node: Send Activation Confirmation3. Get Active Sessions
Monitor active PPPoE sessions:
Trigger: Cron (Every 5 minutes)
↓
Mikrotik Node: Get Active Sessions
- Router Name: main-router
↓
Function Node: Process Session Data
↓
Database: Store Session HistoryOperations
Change Profile
Change a PPPoE user's profile (primary operation for billing automation).
Parameters:
routerName: The name of the router (as configured in middleware)username: PPPoE usernamenewProfile: Target profile name (e.g., "HOME-20MB", "ISOLIR-256K")forceReconnect: (Optional) Force user to reconnect after profile change (default: true)
Example Response:
{
"success": true,
"message": "Profile changed successfully",
"data": {
"username": "customer123",
"oldProfile": "HOME-20MB",
"newProfile": "ISOLIR-256K",
"forcedReconnect": true
}
}Get Active Sessions
Retrieve all active PPPoE sessions from a router.
Parameters:
routerName: The name of the router
Example Response:
{
"success": true,
"data": [
{
"username": "customer123",
"address": "192.168.1.100",
"uptime": "2h30m",
"profile": "HOME-20MB"
}
]
}Enable/Disable User
Enable or disable a PPPoE user account.
Parameters:
routerName: The name of the routerusername: PPPoE username
Force Reconnect
Force a PPPoE user to disconnect and reconnect.
Parameters:
routerName: The name of the routerusername: PPPoE username
Test Connection
Test connectivity to a MikroTik router.
Parameters:
routerName: The name of the router
Middleware Service
This node requires the MikroTik Billing Automation Middleware to be running and accessible.
Quick Start Middleware
# Clone the repository
git clone https://github.com/robioki/golang-routeros-middleware.git
cd golang-routeros-middleware
# Copy environment file
cp .env.example .env
# Edit .env and set your configuration
nano .env
# Run with Docker
docker-compose up -dThe middleware will be available at http://localhost:3000 by default.
Error Handling
All nodes support Continue On Fail setting:
- When enabled, the workflow will continue even if the operation fails
- Error details will be available in the node output under
errorfield - Use a Switch node to handle success/failure paths
Common errors:
- Router not found: Check router name in middleware configuration
- Invalid credentials: Verify API key in credentials
- User not found: PPPoE username doesn't exist on router
- Connection timeout: Router is unreachable or API service is down
Troubleshooting
Node Not Appearing
- Make sure the node is installed:
npm list n8n-nodes-mikrotik - Restart n8n completely
- Check n8n logs for errors
Connection Errors
- Verify middleware service is running:
curl http://localhost:3000/api/v1/health - Check firewall rules between n8n and middleware
- Verify API key in credentials matches middleware
API_KEY
Profile Changes Not Working
- Check middleware execution logs:
docker logs middleware - Verify router credentials in middleware are correct
- Test router connection from middleware UI
- Check that profile exists on MikroTik router
Contributing
Contributions are welcome! Please read CONTRIBUTING.md for details.
License
MIT License - see LICENSE file for details.
Support
- Issues: GitHub Issues
- Documentation: Main Project README
- n8n Community: n8n Community Forum
Related Projects
- MikroTik Billing Automation Middleware - The backend service this node connects to
- n8n - Workflow automation platform
