ERP Integration

Omie Integration Worker | JavaScript

ERP integration workflow connecting Omie sales and product APIs to downstream reporting and operations across multiple business systems

Problem Context, Stack, and System Type

This worker synchronizes Omie ERP sales and product data for analytics and operational reporting. It applies controlled pagination and sanitization for stable data synchronization.

Technical Scope

  • Stack: JavaScript, Node.js, Omie API, Google Sheets API, GitHub Actions
  • System Type: api integration system, ERP automation, backend data pipeline
  • Keywords in context: node.js api, automation system, api integration

Related projects: SIGE Integration Worker and Zoho Integration Worker.

Full Project Documentation

Omie Integration Worker

Source Code Portfolio Author

A Node.js ETL worker that extracts Omie sales order data and synchronizes normalized seller and product/service datasets into Google Sheets.

Overview

This worker is designed for lightweight reporting pipelines where Omie commercial data needs to be centralized in spreadsheet workflows.

The integration focuses on two analytical targets:

  • Vendedor sheet (seller-level sales rows)
  • Produtos e Servicos sheet (line-item level rows)

Architecture

graph TB
		A[Google Auth Worker] -->|repository_dispatch| B[Omie Integration Worker]
		B --> C[Omie API]
		B --> D[Google Sheets API]
		C --> E[Pedidos]
		E --> F[Vendedor Dataset]
		E --> G[Produtos e Servicos Dataset]
		F --> D
		G --> D

Implementation Components

index.js

  • Receives OAuth token for Google Sheets
  • Defines date window (DATA_INICIO / DATA_FIM or current day)
  • Calls Omie listing service
  • Splits payload into seller and item-level datasets
  • Appends rows to target sheets

omieService.js

  • Wraps Omie API requests using axios
  • Injects APP_KEY and APP_SECRET from environment
  • Implements recursive pagination (ListarPedidos)
  • Adds anti-formula sanitization before output write

Core Features

  • Recursive pagination support for complete period extraction
  • Structured transformation for seller and product analytics
  • Safe append-only writes to existing Google Sheets tabs
  • Formula injection mitigation with string sanitization
  • Minimal secure logging with execution status semantics

Configuration

Required Environment Variables

APP_KEY=your_omie_app_key
APP_SECRET=your_omie_app_secret
GOOGLE_TOKEN=oauth_access_token
SPREADSHEET_ID=target_spreadsheet_id
DATA_INICIO=optional_dd/mm/yyyy
DATA_FIM=optional_dd/mm/yyyy

Workflow Trigger

The repository workflow is configured for dispatch-based runs and manual dispatch:

on:
	repository_dispatch:
		types:
			- report_token_ready
	workflow_dispatch:

Output Model

Vendedor

  • date
  • seller name
  • order total
  • order number

Produtos e Servicos

  • date
  • item description
  • quantity
  • unit price
  • seller name

Security Notes

  • API credentials are never hardcoded
  • Environment-injected secrets are required at runtime
  • Sanitization prevents spreadsheet formula payload injection

License

This project is licensed under the MIT License. See LICENSE.

Author

Patrick Araujo - Computer Engineer
GitHub: https://github.com/PkLavc
Portfolio: https://pklavc.com/projects/


Omie Integration Worker - Practical ETL pipeline for ERP sales intelligence and spreadsheet-driven operations.

GitHub Sponsors

Technology Stack

JavaScript
GitHub Actions
Google Sheets
Omie ERP
Node.js

View the Source Code

Open on GitHub