ExactOnline API integration with multiple HTTP calls breaking on automation platforms

I built a script that connects to ExactOnline API to create and modify records. The script runs perfectly when I test it on my computer, but it breaks when I deploy it to automation tools like Zapier or n8n.

The issue seems to happen right before making HTTP requests. Here’s my Zapier code:

const authToken = 'bearer_token';
const companyDivision = 'division_id';

const customerInfo = {
  "Name": "business name",
  "City": "location",
  "Website": "example.org"
};

const personInfo = {
  "FirstName": "john",
  "LastName": "doe", 
  "City": "hometown"
};

async function processAction(actionType) {
  if (actionType == "create_customer_and_contact") {
    const customerResult = await createCustomer(customerInfo);
    const customerId = customerResult;
    
    personInfo.Account = customerId;
    const contactResult = await createPerson(personInfo);
    
    return 'Process completed successfully';
  }
  
  async function createCustomer(data) {
    console.log('Creating customer');
    const response = await sendPOST(1, data);
    return response.d.ID;
  }
  
  async function createPerson(data) {
    const response = await sendPOST(2, data);
    const updateData = { MainContact: response.d.ID };
    await updateCustomer(updateData, data.Account);
  }
  
  async function sendPOST(entityType, payload) {
    let endpoint = `https://start.exactonline.nl/api/v1/${companyDivision}/crm/`;
    endpoint += entityType === 1 ? 'Accounts' : 'Contacts';
    
    const response = await fetch(endpoint, {
      method: "POST",
      headers: {
        'Accept': 'application/json',
        'Authorization': 'Bearer ' + authToken,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify(payload)
    });
    
    return await response.json();
  }
}

output = [processAction("create_customer_and_contact")];

Anyone else experienced similar problems with ExactOnline API on these platforms?

Hit this exact problem 6 months ago with ExactOnline integration. It’s not the async stuff - it’s how Zapier handles Bearer token auth.

Zapier sucks at keeping auth headers consistent across multiple API calls, especially with delays between requests. ExactOnline’s API is super picky about this.

Here’s what worked: Add error handling and token validation before every HTTP call. Also throw in a 1-2 second delay between creating the customer and creating the contact. ExactOnline needs time to process the first record before you can reference it.

Double-check your division ID too. Make sure it’s passing correctly in the automation environment - these platforms handle environment variables differently than your local machine.

Wrap each API call in try-catch blocks and log the actual error responses. You’ll quickly see if it’s auth, timing, or something else.

Your code’s fine. The issue is Zapier and n8n suck at handling sequential API calls. When you create a customer and immediately need that ID for the contact, these platforms lose track of the data flow.

I hit this exact problem with ExactOnline last month. These automation tools can’t maintain state between multiple HTTP calls, especially when one depends on another’s response.

I switched to Latenode and it fixed everything. It’s designed for complex API workflows like yours. You can set up proper sequential steps where each HTTP call waits for the previous one and passes data correctly.

With Latenode, I built the same flow - create customer in ExactOnline, grab the ID, create contact with that customer ID, then update the customer record. No timing issues, no lost variables, no random failures.

It actually understands API dependencies and handles async operations right. Better error handling too - you can see exactly which call fails and why.

Been there with ExactOnline automation - it’s a pain. The problem’s usually how these platforms handle async stuff differently than regular Node.js. Your nested async functions in processAction aren’t waiting properly, so the platform kills execution before your HTTP calls finish. Flatten everything and make it sequential at the top level. Also, ExactOnline’s tricky - it sends 200 status codes even when requests fail, hiding errors in the response body. Your code expects valid data every time without checking. These platforms also have tighter timeouts than local dev. Break it into separate workflows or add timeout handling. Log every step and check what each API call actually returns. Bet your first request is failing silently and breaking everything downstream.

this looks like a scope prob. your async functions r nested inside processAction, but they cant access the vars they need when the automation platform runs em. move createCustomer and createPerson outside of processAction - these platforms handle fn scoping diff than local exec. also double-check that your bearer token is getting passed thru correctly. sometimes these platforms mess with auth headers without warning.

Been there, done that. Zapier and n8n have weird execution environments that can’t handle complex async operations. Your nested functions and multiple API calls are probably timing out or getting killed mid-execution.

I had the same headache with ExactOnline integration last year. Spent days debugging only to find out the platforms were randomly dropping connections.

What worked for me was switching to Latenode. It handles complex workflows much better. You can set up proper error handling, retry logic, and it actually waits for your async calls to complete.

With Latenode, I built the same ExactOnline flow - create customer, get ID, create contact, update customer. Works perfectly because it doesn’t have those execution limitations.

The visual workflow builder makes debugging easier too. You can see exactly where things break.