totvs-rm

Native n8n nodes for TOTVS ERP Linha RM — DataServer REST, native REST APIs, automatic JWT auth, and full module coverage

Package Information

Downloads: 6 weekly / 35 monthly
Latest Version: 1.0.1
Author: Vinicius Espindola

Documentation

TOTVS RM logo

n8n-nodes-totvs-rm

Native n8n nodes for TOTVS ERP Linha RM

Connect your n8n workflows directly to TOTVS RM — with automatic JWT authentication, access to any DataServer, and dedicated operations for HR, Payroll, Stock, Finance, Accounting, and more.

npm version
License: MIT
n8n community


✨ Features

  • 🔐 Automatic JWT authentication — token obtained and cached automatically (renewed before expiry)
  • 🗄️ Generic DataServer access — call any of the 1,000+ DataServers via RMSRestDataServer
  • 📦 12 dedicated modules with pre-built operations
  • 🔍 SQL filter supportLIKE, AND, OR, IN, field selection, pagination, ordering
  • 🌐 Bilingual interface (PT-BR / EN)

📦 Modules & Operations

Module Key Operations
Framework Get JWT Token, Health Check, List DataServers
DataServer (Generic) List, Read, Create, Update, Delete any DataServer
Employees (HR) List, Get by Badge, Create, Update, Dismiss
Payroll List Calculations, Get Calculation
Invoice (Stock) List, Get, Create, Cancel
Stock Movement List, Get, Create
Accounts Payable/Receivable List, Get, Create, Mark as Paid
Accounting Entry List, Get, Create
Customers / Suppliers List, Get, Create, Update
Users List, Get, Create, Update
Companies List, Get
Enrollment (Education) List, Get, Create

🚀 Installation

Option 1 — n8n self-hosted

# Go to your n8n custom nodes directory
cd ~/.n8n/nodes

# Clone the repository
git clone https://github.com/espindolavinicius/n8n-nodes-totvs-rm.git
cd n8n-nodes-totvs-rm

# Install and build
npm install
npm run build

# Restart n8n

Option 2 — via npm (after publishing)

npm install n8n-nodes-totvs-rm

Option 3 — Docker

Add to your Dockerfile or docker-compose.yml:

RUN cd /home/node && npm install n8n-nodes-totvs-rm

Or with docker-compose.yml:

services:
  n8n:
    image: n8nio/n8n
    environment:
      - N8N_NODES_INCLUDE=n8n-nodes-totvs-rm
    volumes:
      - n8n_data:/home/node/.n8n

⚙️ Credential Setup

In n8n, go to Settings → Credentials → New → TOTVS RM API and fill in:

Field Example Description
RM Host URL http://10.0.0.1:8051 Address of RM.Host.Service
Username admin RM system login
Password **** User password
Default Company Code 1 CODCOLIGADA
Default Branch Code 1 CODFILIAL

Tip: Make sure port 8051 is accessible from the n8n server. For HTTPS, use https://your-server:port.


💡 Usage Examples

List active employees

  • Module: Employees (HR)
  • Operation: List Employees
  • SQL Filter: CODCOLIGADA=1 AND CODSITUACAO='A'
  • Order By: NOME ASC

Get a specific invoice

  • Module: Invoice (Stock)
  • Operation: Read Record
  • SQL Filter: CODCOLIGADA=1 AND NUMERONF='000001234'

Use a custom DataServer

  • Module: DataServer (Generic)
  • Operation: List Records (GetAll)
  • DataServer Name: SmtAtestadoData
  • SQL Filter: CODCOLIGADA=1

Discover all available DataServers

  • Module: Framework
  • Operation: List Available DataServers

🗂️ Common DataServers Reference

Module DataServer Description
HR / Employees FopFuncData Employee register
HR / Payroll FopFolhaCalcData Payroll calculation
HR / Medical SmtAtestadoData Medical certificates
Stock / Invoice FisNfData Invoices
Stock / Movement TMovData Stock movements (TMOV)
Stock / Items TITMMovData Movement items
Financial MovData Financial entries
Accounting CttLancData Accounting journal
Global / Person GlbPessoaData Customers and suppliers
Global / User GlbUsuarioData System users
Global / Company GlbColigadaData Companies
Education EduMatriculaData Student enrollments

🛠️ RM Host Configuration

In RM.Host.exe.config or RM.Host.Service.exe.config, ensure:

<add key="HttpPort" value="8051"/>
<add key="ENABLESWAGGER" value="true"/>

For custom SSL certificate:

<add key="JWTCERTIFICATETHUMBPRINT" value="YOUR_THUMBPRINT_HERE"/>

🔐 How Authentication Works

  1. On the first call, the node sends POST /api/connect/token with username and password
  2. The JWT token is cached in memory with its expiry time
  3. The token is automatically renewed 60 seconds before expiry
  4. Every request includes Authorization: Bearer <token>

🤝 Contributing

Pull requests are welcome! To add a new module:

  1. Add the resource option in TotvsRm.node.ts
  2. Add the operations block with displayOptions
  3. Map the DataServer in dsMap
  4. Update this README

👨‍💻 Author

Vinicius Espindola


📄 License

MIT © Vinicius Espindola

Discussion