UNPKG

n8n-nodes-myobv2

Version:

Comprehensive n8n node for MYOB Business API - Sales Orders, Customers, Items, Invoices, and more

333 lines (265 loc) โ€ข 13.4 kB
# Changelog All notable changes to the MYOB v2 community node will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [1.4.7] - 2025-08-28 ### Fixed - **Critical**: Fixed pagination handling for absolute NextPageLink URLs from MYOB API - Correctly handles NextPageLink URLs with different subdomains (e.g., "arl2.api.myob.com") - Fixed 404 errors when NextPageLink contains full absolute URLs instead of relative paths - Enhanced pagination logic to detect and handle both relative and absolute URLs properly ### Technical Details - Added detection for absolute URLs (starting with "http") in NextPageLink - Direct HTTP request handling for absolute URLs bypasses baseUrl concatenation - Maintains authentication headers and credentials for direct absolute URL requests - Preserves backward compatibility with relative URL handling - Prevents invalid URL construction that caused 404 errors during pagination ### Impact - "Fetch All Pages" feature now works reliably with all MYOB API subdomain variations - Eliminates 404 errors when MYOB returns NextPageLink with different API subdomains - Ensures complete data retrieval during pagination regardless of URL format ## [1.4.6] - 2025-08-28 ### Added - **Debug Version**: Added comprehensive debugging logs to diagnose pagination URL issues - Detailed console logging for NextPageLink processing and URL construction - Step-by-step pagination debugging information for troubleshooting - Enhanced error reporting for URL parsing failures ### Fixed - Extended NextPageLink handling with multiple fallback strategies - Added manual query string extraction when URL parsing fails - Improved debugging visibility for pagination URL processing - Enhanced error handling for malformed pagination URLs ### Technical Details - Added detailed console logs for debugging pagination issues - Implemented multiple URL parsing strategies with fallbacks - Enhanced NextPageLink processing with comprehensive error handling - Added step-by-step debugging for pagination URL construction ## [1.4.5] - 2025-08-28 ### Fixed - **Critical**: Fixed 404 errors when using "Fetch All Pages" feature in customer list operation - Improved NextPageLink URL parsing to handle both absolute and relative URLs from MYOB API - Added fallback handling for URL parsing failures in pagination logic - Enhanced error handling for edge cases in pagination URL processing ### Technical Details - Fixed `new URL()` parsing issues with MYOB's NextPageLink format - Added robust URL handling that supports both full URLs and relative paths - Improved error recovery when pagination links are malformed - Enhanced pagination reliability across different MYOB API response formats ## [1.4.4] - 2025-08-28 ### Added - **Customer List Pagination**: Added "Fetch All Pages" option to customer list operation - Automatic pagination handling that follows MYOB's NextPageLink to retrieve all customers - Pagination metadata in response showing total pages fetched and items retrieved - Enhanced customer list operation to handle large datasets efficiently ### Changed - Customer list operation now supports both single-page (default) and multi-page fetching - When "Fetch All Pages" is enabled, the limit parameter is used for page size but all pages are fetched - Response format includes PaginationInfo with fetchedAllPages, totalPages, itemsPerPage, and totalItemsRetrieved ### Technical Details - Implemented automatic NextPageLink following in customer list operation - URL parsing to extract endpoint paths from MYOB's pagination links - Consolidated response format maintains compatibility with existing workflows - Added TypeScript typing improvements for pagination variables ### Usage - Set "Fetch All Pages" to true to retrieve all customer records regardless of total count - Useful for syncing complete customer databases or generating comprehensive reports - Maintains filter and other query parameters across all pages ## [1.4.3] - 2025-08-28 ### Added - **OAuth Scope Enhancement**: Added `sme-contacts-customer` scope to OAuth2 configuration - Enhanced customer contact data access permissions - Improved customer management capabilities ### Changed - Updated OAuth2 scopes to include customer contact information access - OAuth configuration now requests: `sme-company-settings sme-sales sme-inventory sme-contacts-customer` ### Technical Details - Modified `MyobOAuth2Api.credentials.ts` to include additional scope - New scope enables broader customer data access and management - Requires re-authentication of OAuth2 credentials in N8N to take effect ## [1.4.2] - 2025-08-25 ### Reverted - **Customer List Authorization Changes**: Rolled back the complex fallback logic from v1.4.1 - Restored customer list operation to original simple implementation - Customer authorization issues remain to be investigated through different approaches ### Note - This version restores the exact functionality of v1.4.0 - Customer list operation may still experience authorization issues in some configurations - All other operations (sales orders, items, invoices) remain fully functional ## [1.4.0] - 2025-08-23 ### Added - **New Operation**: Get Inventory Items for Items/Inventory resource - Enhanced inventory management with location-specific stock levels - Returns SKU, product description, and quantity on hand for specified location - Includes additional inventory metrics: available quantity, committed quantity - Location-specific filtering with automatic active/inventoried item filtering ### Features - **Location-Based Inventory**: Query inventory quantities for specific MYOB locations - **Comprehensive Stock Data**: Returns quantity on hand, available quantity, and committed quantity - **Rich Item Information**: Provides SKU, description, name, and base selling price - **Smart Filtering**: Only returns active and inventoried items by default - **Metadata Summary**: Includes total items count and items with stock count - **OData Filtering Support**: Use advanced filters with the new operation ### Technical Details - Uses MYOB API's `$expand=InventoryQuantity` for efficient data retrieval - Single API call fetches all item details and location-specific quantities - Implements location-based quantity lookup with fallback handling - Returns structured response with success indicators and metadata ### Usage Example ```javascript Resource: Item Operation: Get Inventory Items Location UID: "your-location-uid" Limit: 100 Filter: IsActive eq true and IsInventoried eq true ``` ## [1.2.6] - 2025-01-11 ### Fixed - **Critical**: Resolved "Lines[0].Location.UID" error in updateOrder operation - Added Location UID to all line items to satisfy MYOB API requirement for inventoried items - Each line item now includes `Location: { UID: defaultLocationUid }` in the payload - Ensures compliance with MYOB inventory tracking requirements ### Technical Details - Updated line item processing logic in updateOrder operation - All line items now include the required Location UID parameter - Prevents MYOB API validation errors for inventoried products - Uses the configured Default Location UID for all line items ## [1.2.5] - 2025-01-11 ### Fixed - **Critical**: Resolved "TaxCode is required" error in updateOrder operation - Added comprehensive tax code fallback logic for all line items - Implemented three-level tax code resolution: 1. SKU-matched item's SellTaxCode UID 2. Default product's SellTaxCode UID 3. Configured Default Tax Code UID (new required parameter) - Added tax code handling for shipping line items - Ensured all line items always have a TaxCode UID assigned ### Added - New required parameter: "Default Tax Code UID" for updateOrder operation - Tax code fallback logic for shipping line items (uses freight tax code or default) - Comprehensive validation to prevent MYOB TaxCode validation errors ### Changed - updateOrder operation now requires Default Tax Code UID parameter - Improved tax code assignment reliability - Enhanced error handling for tax code lookups ## [1.0.0] - 2025-01-11 ### Added #### ๐ŸŽ‰ Multi-Resource Support - **Sales Orders**: Create, Get, List operations - **Customers**: Create, Get, List operations - **Items/Inventory**: Create, Get, List operations - **Invoices**: Get, List, Create from Sales Order operations #### ๐Ÿ”ง Resource-Operation Architecture - Resource selector with 4 main categories - Operation-specific field visibility - Unified authentication across all resources - Consistent error handling patterns #### ๐Ÿ“ฆ Sales Order Features - Create sales orders with multiple line items - Support for UI form input and JSON array input - Shopify webhook integration with automatic SKU lookup - Discount calculation from Shopify discount allocations - Multi-line shipping address support - Shipping line item integration - Purchase order number support with automatic lookup - Fallback SKU support for missing items #### ๐Ÿ‘ฅ Customer Management - Create customers with company name, email, phone - Auto-generated customer numbers (optional override) - Address and contact information support - Customer lookup by UID - Customer listing with OData filtering #### ๐Ÿ“‹ Item/Inventory Management - Create inventory items with SKU, name, description, price - Get items by UID or SKU lookup - List items with advanced filtering - Automatic inventory item configuration (sold/bought flags) - Base selling price support #### ๐Ÿงพ Invoice Operations - Get invoices by UID - List invoices with filtering - Convert sales orders to invoices automatically - Preserve sales order details (customer, lines, addresses, etc.) #### ๐Ÿ” Advanced List Operations - OData filtering support for all list operations - Pagination with configurable limits - Date range filtering - Boolean and text matching filters - Numeric comparison filters #### ๐Ÿ›ก๏ธ Error Handling & Validation - Graceful SKU lookup failures with default fallback - Detailed error messages with context - Network error handling with retry suggestions - Field validation with clear error descriptions - Continue-on-fail support for batch operations #### ๐Ÿ” Authentication - OAuth2 integration with MYOB cloud - Automatic base URL construction from company file GUID - Secure credential management - Token refresh handling #### ๐Ÿ“Š Shopify Integration - Direct support for Shopify webhook line_items structure - Automatic price parsing (string to number) - Quantity handling (current_quantity fallback) - Product title and variant consolidation - Discount allocation processing - Empty SKU handling with defaults #### ๐Ÿ”ง Technical Features - TypeScript implementation with full type safety - Modular handler architecture for each resource - Async/await patterns for all API calls - Comprehensive input validation - Response normalization across operations ### Technical Details #### API Endpoints Covered - `/Sale/Order/Item` - Sales order operations - `/Contact/Customer` - Customer operations - `/Inventory/Item` - Item/inventory operations - `/Sale/Invoice/Item` - Invoice operations #### Node Structure - Resource-based operation routing - Conditional field visibility based on resource/operation - Unified parameter handling - Modular handler methods for maintainability #### Error Handling Strategy - Try-catch blocks for all operations - Specific error types for different failure modes - Fallback mechanisms for SKU lookup failures - Detailed logging for troubleshooting #### Performance Considerations - Efficient SKU lookup caching within single execution - Minimal API calls through intelligent request batching - Proper error propagation to prevent unnecessary processing ### Breaking Changes This is the initial release of the v2 architecture. Users migrating from v1 (n8n-nodes-myob) will need to: 1. Update node configuration to use Resource/Operation pattern 2. Review field mappings as some fields have been reorganized 3. Update any workflows that depend on specific v1 response formats ### Migration Guide from v1 #### v1 โ†’ v2 Mapping ```javascript // v1 Configuration Node: MYOB Sales Order Operation: Create (implicit) // v2 Configuration Resource: Sales Order Operation: Create ``` #### Field Changes - All sales order fields remain the same - New resources (Customer, Item, Invoice) add new capabilities - List operations add filtering and pagination options ### Known Issues - Invoice creation returns MYOB's standard response format (may not include full invoice details) - Large result sets may require pagination for optimal performance - SKU lookup is case-sensitive and requires exact matches ### Future Roadmap #### Planned for v1.1.0 - Purchase order operations - Payment handling - Tax code management - Enhanced filtering options #### Under Consideration - Account management - Report generation - Time billing integration - Advanced custom field support