Goal: Automate the collection and consolidation of daily financial analytics from various marketplaces (Prom, Umall, Rozetka) through CRM SalesDrive in Telegram. Key challenge: to merge data from disparate sources (different formId) and ensure the accuracy of profit calculations and "sales hits" amid unstable transmission of system dates via API.
Solution: Multi-threaded architecture on n8n (self-hosted on Railway):
1. Data Extraction (SalesDrive API Pipeline)
Multi-Source Fetching: Implemented separate HTTP requests for the PROM + UMALL branches and ROZETKA. Specific authentication headers were used for each source.
Precision Filtering: Configured strict filtering by time windows (00:00:00 – 23:58:59) through orderTime and createTime parameters, eliminating the pulling of "historical" orders when edited by managers.
Status Validation: The system automatically filters out technical junk and canceled requests (status 32/51), ensuring that only real "cash" enters the report.
2. Analytics Engine (JS Code Logic)
Financial Aggregator: Code Node acts as a backend processor: it parses arrays of orders, converts string data to numbers (parseFloat), and sums up turnover and net profit in real-time.
Product Hit Detection: The algorithm dynamically counts the number of units sold for each SKU, identifies the leader of the day ("Sales Hit"), and outputs its name along with the number of sales.
Data Normalization: Automatic unification of product names and SKUs, even if they are missing in individual objects of the products array.
Result:
Reporting Design: Formation of a strict business report in Telegram using a monospaced font for easy reading of numbers and instant copying of EDRPOU/amounts with one tap.
Operational Control: The owner receives a complete picture of sales in 1 second without the need to log into CRM and manually build filters.
Reliability: Thanks to hosting on Railway and optimized connection timeouts to the database (PostgreSQL), the system reliably processes requests even during peak load hours on marketplaces.
#n8n #SalesDrive #ECommerce #Prom #Rozetka #BusinessIntelligence #Automation #API #Railway
Solution: Multi-threaded architecture on n8n (self-hosted on Railway):
1. Data Extraction (SalesDrive API Pipeline)
Multi-Source Fetching: Implemented separate HTTP requests for the PROM + UMALL branches and ROZETKA. Specific authentication headers were used for each source.
Precision Filtering: Configured strict filtering by time windows (00:00:00 – 23:58:59) through orderTime and createTime parameters, eliminating the pulling of "historical" orders when edited by managers.
Status Validation: The system automatically filters out technical junk and canceled requests (status 32/51), ensuring that only real "cash" enters the report.
2. Analytics Engine (JS Code Logic)
Financial Aggregator: Code Node acts as a backend processor: it parses arrays of orders, converts string data to numbers (parseFloat), and sums up turnover and net profit in real-time.
Product Hit Detection: The algorithm dynamically counts the number of units sold for each SKU, identifies the leader of the day ("Sales Hit"), and outputs its name along with the number of sales.
Data Normalization: Automatic unification of product names and SKUs, even if they are missing in individual objects of the products array.
Result:
Reporting Design: Formation of a strict business report in Telegram using a monospaced font for easy reading of numbers and instant copying of EDRPOU/amounts with one tap.
Operational Control: The owner receives a complete picture of sales in 1 second without the need to log into CRM and manually build filters.
Reliability: Thanks to hosting on Railway and optimized connection timeouts to the database (PostgreSQL), the system reliably processes requests even during peak load hours on marketplaces.
#n8n #SalesDrive #ECommerce #Prom #Rozetka #BusinessIntelligence #Automation #API #Railway