Automatically synchronize orders, inventory, fulfillments, customers, and pricing between Shopify and Sage BusinessWorks — no manual data entry required.
Get Started · Data Flows · Documentation · Support
Built by 4th and Bailey — Enterprise IT Consulting · Houston, TX · Serving Organizations Nationwide
The Shopify Sage BusinessWorks Integration Agent is an open-source Windows Service middleware that bridges the gap between Shopify's cloud-native e-commerce platform and Sage BusinessWorks, a powerful on-premises accounting and ERP solution.
Sage BusinessWorks has no REST API and no native cloud connectivity. This agent solves that — running silently in the background on your Windows server, automatically syncing critical business data in both directions using BWGACCESS (Sage's official third-party data access SDK) and 32-bit ODBC for read queries.
Most Shopify ↔ Sage integrations assume a cloud ERP. Sage BusinessWorks is different — it is a Windows-native, on-premises application with its own data file structure. This agent was purpose-built to solve that challenge without requiring manual CSV exports, double data entry, or expensive proprietary middleware subscriptions.
- ✅ Runs as a Windows Service — starts automatically on boot, manageable via
services.mscorsccommands - ✅ Automatic restart — recovers from failures with configurable retry policy and exponential back-off
- ✅ Real-time order sync — Shopify webhooks trigger immediate order import into BusinessWorks
- ✅ Bidirectional sync — data flows in both directions across all five key data domains
- ✅ Change detection — inventory and pricing only update when values actually change, minimizing API calls
- ✅ Graceful shutdown — waits for in-progress sync flows to complete before stopping
- ✅ Persistent state — sync cursors survive service restarts via JSON state files
- ✅ Structured logging — daily rotating log files with configurable retention
- ✅ No SaaS subscription — fully open source, self-hosted, no per-seat fees
┌─────────────────────┐ ┌─────────────────────────────┐ ┌──────────────────────┐
│ Shopify Store │◄───────►│ Middleware Agent (Windows) │◄──────►│ Sage BusinessWorks │
│ │Webhooks │ Node.js Windows Service │BWGACCESS│ (Local / Network) │
│ GraphQL Admin API │+ Polling│ Runs on BW server │ +ODBC │ Database Files │
└─────────────────────┘ └─────────────────────────────┘ └──────────────────────┘
| Direction | Data | Trigger | Method |
|---|---|---|---|
| Shopify → BusinessWorks | New / updated orders | Webhook + 5-min poll | BWGACCESS CSV import |
| BusinessWorks → Shopify | Shipped order tracking & fulfillment | 5-min poll | ODBC read + GraphQL |
| BusinessWorks → Shopify | Inventory levels | 10-min poll | ODBC read + GraphQL |
| BusinessWorks → Shopify | Customer records | Hourly poll | ODBC read + GraphQL |
| BusinessWorks → Shopify | Product pricing | 30-min poll | ODBC read + GraphQL |
| Requirement | Notes |
|---|---|
| Windows Server 2016+ or Windows 10/11 | Must be on same machine or network as BusinessWorks |
| Node.js 18+ (64-bit) | Download from nodejs.org |
| Sage BusinessWorks | Any recent version |
| BWGACCESS SDK | Obtained from Sage — email [email protected] |
| ODBC DSN (32-bit) | Configured in Windows ODBC Data Source Administrator (32-bit) |
| Shopify Custom App | Scopes: read_orders, write_fulfillments, read_products, write_inventory, read_customers, write_customers |
Place the project folder on the Windows machine that runs Sage BusinessWorks:
git clone https://github.com/4thandBailey/shopify-bw-agent.git C:\ShopifyBWAgent
cd C:\ShopifyBWAgentOpen a Command Prompt as Administrator:
cd C:\ShopifyBWAgent
npm installCopy .env.example to .env and fill in all values:
copy .env.example .env
notepad .envKey settings:
# Shopify
SHOPIFY_STORE_URL=https://your-store.myshopify.com
SHOPIFY_ACCESS_TOKEN=shpat_...
# Sage BusinessWorks ODBC (32-bit DSN name)
BW_ODBC_DSN=SageBusinessWorks
# BWGACCESS paths
BWGACCESS_EXE_PATH=C:\SageBusinessWorks\BWGACCESS\BWGACCESS.exe
BWGACCESS_IMPORT_DIR=C:\SageBusinessWorks\imports
BWGACCESS_EXPORT_DIR=C:\SageBusinessWorks\exports
BWGACCESS_COMPANY_DIR=C:\SageBusinessWorks\Company- Open ODBC Data Source Administrator (32-bit):
C:\Windows\SysWOW64\odbcad32.exe - Add a System DSN pointing to your Sage BusinessWorks database
- The DSN name must match
BW_ODBC_DSNin your.env
Sage BusinessWorks table names vary slightly by version. Open src/services/businessworks.js and confirm the SQL queries match your ODBC schema:
| Table | Module | Contents |
|---|---|---|
IC_ITEM |
Inventory Control | Item master — qty on hand, pricing |
OE_ORDER_HEADER |
Order Entry | Order headers, ship dates, tracking |
AR_CUSTOMER |
Accounts Receivable | Customer master records |
IC_PRICE_LEVEL |
Inventory Control | Price levels per item |
Tip: Use Excel's built-in ODBC connection or Microsoft Access linked tables to browse your BusinessWorks schema and confirm table names.
The fulfillment sync stores the Shopify Order ID in a custom field SHOPIFY_ORDER on OE_ORDER_HEADER. Work with your BusinessWorks consultant to add this field, or configure the agent to use an existing reference/comment field.
Run as Administrator:
cd C:\ShopifyBWAgent
node scripts/install-service.jsThis registers ShopifyBWAgent in Windows Services, sets it to start automatically on boot, configures automatic restart on failure, and starts the service immediately.
Via Windows Service Manager (GUI):
- Press
Win + R, typeservices.msc, press Enter - Find ShopifyBWAgent in the list
- Right-click → Start / Stop / Restart / Properties
Via Command Line:
sc start ShopifyBWAgent # Start the service
sc stop ShopifyBWAgent # Stop the service
sc query ShopifyBWAgent # Check statusnode scripts/uninstall-service.jsTest the agent locally without installing it as a Windows Service:
npm run devDevelopment mode skips the initial startup sync, logs to the console with colour output, and runs the webhook server on localhost only.
Register these webhooks in your Shopify Partner Dashboard or via the Admin API for real-time order triggering:
| Topic | Endpoint |
|---|---|
orders/create |
https://YOUR-SERVER:3456/webhooks/orders/create |
orders/updated |
https://YOUR-SERVER:3456/webhooks/orders/updated |
Shopify requires HTTPS for webhooks. Place a reverse proxy (nginx, IIS, Caddy) in front of the agent for production deployments.
| File | Contents |
|---|---|
shopify-bw-agent-YYYY-MM-DD.log |
All log levels (info, warn, error, debug) |
shopify-bw-agent-error-YYYY-MM-DD.log |
Errors only |
state/*.json |
Sync state — last run timestamps, processed order IDs |
Logs rotate daily, are compressed, and are deleted after LOG_RETENTION_DAYS (default: 30 days).
| Problem | Solution |
|---|---|
| ODBC connection fails | Verify DSN name in 32-bit ODBC Admin (odbcad32.exe); confirm BusinessWorks is running |
| BWGACCESS fails | Confirm executable path in .env; run BWGACCESS manually to verify license |
| Shopify 401 Unauthorized | Regenerate access token in Shopify Partner Dashboard; verify app scopes |
| Orders not importing into BW | Review BW Order Entry CSV import spec; check ordersToBusinessWorks logs |
| Service won't start | Open Windows Event Viewer → Windows Logs → Application for error details |
| Inventory not updating | Confirm Shopify SKU values match BW ITEM_CODE exactly (case-insensitive) |
| Fulfillments not syncing | Verify SHOPIFY_ORDER field exists on OE_ORDER_HEADER; check order STATUS = 'S' |
shopify-bw-agent/
├── src/
│ ├── agent.js # Main entry point, cron scheduler, graceful shutdown
│ ├── config/
│ │ └── index.js # Environment config loader with validation
│ ├── services/
│ │ ├── shopify.js # Shopify GraphQL Admin API client
│ │ ├── businessworks.js # Sage BusinessWorks ODBC + BWGACCESS client
│ │ └── webhookServer.js # Express webhook HTTP server
│ ├── flows/
│ │ ├── ordersToBusinessWorks.js # Shopify unfulfilled orders → BW Order Entry
│ │ ├── fulfillmentsToShopify.js # BW shipped orders → Shopify fulfillments
│ │ ├── inventoryToShopify.js # BW inventory levels → Shopify stock
│ │ ├── customersToShopify.js # BW AR customers → Shopify customers
│ │ └── pricingToShopify.js # BW item pricing → Shopify variant prices
│ └── utils/
│ ├── logger.js # Winston rotating file logger
│ └── stateStore.js # Persistent JSON sync-cursor state store
├── scripts/
│ ├── install-service.js # Register as Windows Service (run as Admin)
│ └── uninstall-service.js # Remove Windows Service
├── logs/ # Runtime logs (git-ignored)
├── CHANGELOG.md # Version history
├── METHODOLOGY.md # Architecture decisions and design rationale
├── SECURITY.md # Security policy and vulnerability disclosure
├── .env.example # Fully documented configuration template
├── package.json
└── README.md
| Document | Description |
|---|---|
| CHANGELOG.md | Full version history following Keep a Changelog format |
| METHODOLOGY.md | Architecture decisions, integration pathway rational, design tradeoffs |
| SECURITY.md | Security model, credential handling, vulnerability disclosure process |
This agent is open source and free to use. If you need professional implementation, customization, or ongoing support, 4th and Bailey provides enterprise IT consulting services nationwide.
📧 inquiries@4thandbailey.com 📞 (888) 305-5977 🌐 4thandbailey.com 💼 LinkedIn
| Project | Description |
|---|---|
| Infrastructure Placement Framework | Vendor-neutral framework for cloud, on-premises, hybrid, and AI infrastructure decisions |
| Microsoft 365 PowerShell Tools | Free M365 admin scripts — MFA reporting, inactive users, license optimization |
MIT License — free to use, modify, and distribute. See LICENSE for details.
Built with ❤️ in Houston, TX by 4th and Bailey
Boutique firm. Enterprise standards. Principal-led on every engagement.