Mayank Tiwari

Integration · Case study

ERP to HubSpot Bidirectional Sync

Legacy ERP system integration with HubSpot using XML/FTP processing.

The challenge

Legacy ERP system only exported XML files to FTP, needed real-time bidirectional sync with HubSpot.

What I built

Created automated solution using n8n to monitor FTP for XML files, convert to JSON, map to HubSpot fields, and sync both ways using webhooks.

Results

  • 100k+ deal records migrated and kept in sync in both directions
  • Millions of deal line items synced one way from the ERP
  • Ran in production for 2 years
  • Successful legacy ERP integration
  • Real-time bidirectional data synchronization
  • Automated XML to JSON conversion
  • Seamless FTP monitoring and processing

Tech stack

  • n8n
  • HubSpot API
  • XML Processing
  • FTP
  • JSON

Code sketch

A simplified illustration of the core logic, not production code.

// ERP XML to HubSpot Sync Workflow
const processERPXMLFile = async (ftpFilePath) => {
  // Download XML file from FTP
  const xmlContent = await ftp.downloadFile(ftpFilePath);
  
  // Parse XML to JavaScript object
  const xmlData = await parseXML(xmlContent);
  
  // Transform to HubSpot format
  const hubspotData = xmlData.customers.map(customer => ({
    firstname: customer.firstName,
    lastname: customer.lastName,
    email: customer.email,
    company: customer.companyName,
    custom_erp_id: customer.erpId
  }));
  
  // Batch sync to HubSpot
  const syncResults = await hubspot.contacts.batchCreate(hubspotData);
  
  // Handle HubSpot webhook for reverse sync
  const hubspotUpdates = await getHubSpotUpdates();
  await syncBackToERP(hubspotUpdates);
  
  return syncResults;
};

Related services

More Integration case studies

Need something similar?

Tell me which systems are involved and what should happen between them.