npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

n8n-nodes-routeros-middleware

v1.1.6

Published

n8n node for interacting with MikroTik RouterOS via Middleware Service

Readme

n8n-nodes-routeros-middleware

npm version License: MIT

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)

  1. In your n8n instance, go to SettingsCommunity Nodes
  2. Click Add and search for n8n-nodes-routeros-middleware
  3. Click Install

Option 2: Manual Installation

cd ~/.n8n
npm install n8n-nodes-routeros-middleware

Then 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 .env file)

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 Reminder

2. 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 Confirmation

3. 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 History

Operations

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 username
  • newProfile: 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 router
  • username: PPPoE username

Force Reconnect

Force a PPPoE user to disconnect and reconnect.

Parameters:

  • routerName: The name of the router
  • username: 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 -d

The 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 error field
  • 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

  1. Make sure the node is installed: npm list n8n-nodes-mikrotik
  2. Restart n8n completely
  3. Check n8n logs for errors

Connection Errors

  1. Verify middleware service is running: curl http://localhost:3000/api/v1/health
  2. Check firewall rules between n8n and middleware
  3. Verify API key in credentials matches middleware API_KEY

Profile Changes Not Working

  1. Check middleware execution logs: docker logs middleware
  2. Verify router credentials in middleware are correct
  3. Test router connection from middleware UI
  4. 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

Related Projects