Opening Problem Statement
Meet Lisa, a customer success manager at a fast-growing SaaS company. Every day, Lisa spends a frustrating hour manually updating company details between HubSpot and Zendesk. Data mismatches cause customer service delays, lost sales opportunities, and confusion among her team. Despite using both platforms effectively, Lisa’s team struggles with outdated or inconsistent company information across their tools. The wasted time—up to five hours a week—adds up to missed deadlines and lower customer satisfaction scores.
This scenario is exactly what this n8n workflow addresses: automatic synchronization of company data between HubSpot and Zendesk, ensuring up-to-date, accurate organizational information across both platforms, saving time and reducing costly errors.
What This Automation Does
This workflow automatically syncs recently modified companies in HubSpot with organizations in Zendesk every five minutes. Here’s what happens when it runs:
- Fetches the latest update timestamp to track changes since last run.
- Retrieves recently modified companies from HubSpot after that timestamp.
- Gets all existing organizations from Zendesk.
- Matches each HubSpot company to Zendesk organizations by name.
- Updates existing Zendesk organizations if company info has changed.
- Creates new Zendesk organizations for any HubSpot companies missing in Zendesk.
Benefits include eliminating manual data entry, reducing synchronization errors, improving customer data reliability, and saving hours each week on administrative tasks.
Prerequisites ⚙️
- n8n account (cloud or self-hosted) 🔌
- HubSpot account with API access and an App Token credential set up in n8n 🔑
- Zendesk account with API credentials configured in n8n 🔑
Step-by-Step Guide
1. Setup Cron Trigger (Every 5 minutes)
Navigate to the n8n editor. Click + → Trigger → Cron. Set it to execute every 5 minutes by choosing Every X Minutes, value = 5. This node triggers the workflow repeatedly to check for updates.
Expected: Your workflow now runs repeatedly every five minutes without manual start.
Common mistake: Forgetting to enable the workflow after setup.
2. Retrieve Last Execution Timestamp
Add a Function Item node named “Get last execution timestamp”. Enter this JavaScript code to get the last saved timestamp or initialize it on first run:
const staticData = getWorkflowStaticData('global');
if(!staticData.lastExecution){
staticData.lastExecution = new Date();
}
item.executionTimeStamp = new Date();
item.lastExecution = staticData.lastExecution;
return item;This sets the reference point to only fetch company changes since the last run, reducing unnecessary data processing.
Common mistake: Not using global static data will cause timestamp resets each run.
3. Fetch Recently Modified Companies from HubSpot
Add a HubSpot node, set to resource “company”, operation “getRecentlyModified”. Use the expression {{$json["lastExecution"]}} for the ‘since’ filter, so you only fetch changes after the last execution timestamp.
Example: If lastExecution is “2024-06-01T10:00:00Z”, only companies modified after this will be pulled.
Expected outcome: Only recently updated companies will flow out.
Common mistake: Wrong expression syntax or forgetting to set authentication.
4. Fetch All Organizations from Zendesk
Add a Zendesk node with operation “getAll” on the organization resource. Configure to return all Zendesk organizations for matching.
This node supplies reference data to merge with HubSpot company info.
Common mistake: Not setting up Zendesk API credentials beforehand causes authentication errors.
5. Merge HubSpot Companies with Zendesk Organizations
Add a Merge node configured to mergeByKey with the following mappings:
- Property Name 1:
properties.name.value(HubSpot company name) - Property Name 2:
name(Zendesk organization name)
This pairing helps identify which companies already exist in Zendesk.
Expected result: Each item now has both HubSpot and Zendesk data side-by-side.
Common mistake: Using incorrect JSON paths will result in failed merges.
6. Check if Company Exists in Zendesk
Add an If node to check if the Zendesk organization ID exists by testing if {{$json["id"]}} is not empty.
If true, the company exists and should be updated; if false, create new Zendesk organizations.
7. Update Existing Zendesk Organization
For companies found in Zendesk, add a Zendesk node configured to update organizations with the HubSpot company name and domain:
ID: {{$json["id"]}}
Name: {{$json["properties"].name.value}}
Domain Names: {{$json["properties"].domain.value}}Expected: Zendesk organization records reflect HubSpot changes automatically.
8. Create New Zendesk Organizations
For companies not found in Zendesk, add a Zendesk node configured to create organizations with the company’s name and domain from HubSpot:
Name: {{$json["properties"].name.value}}
Domain Names: {{$json["properties"].domain.value}}Expected: Newly added HubSpot companies are now reflected in Zendesk.
9. Update Last Execution Timestamp
Finally, add a Function Item node named “Set new last execution timestamp” with this code to save the current execution timestamp as the new last execution time:
const staticData = getWorkflowStaticData('global');
staticData.lastExecution = $item(0).$node["Get last execution timestamp"].executionTimeStamp;
return item;This ensures future runs continue to fetch only incremental changes.
Customizations ✏️
- Change Sync Frequency: Adjust cron timing node to run every 10 or 15 minutes for less frequent updates.
- Extend Data Fields: In update and create Zendesk nodes, add additional custom fields such as phone numbers or addresses from HubSpot properties.
- Filter Companies: Modify the HubSpot “getRecentlyModified” node filters to only sync companies from specific domains or with tags.
- Notification on Sync: Add an email or Slack node after sync to notify team members of updates.
- Use Different Merge Logic: Switch the Merge node to other modes such as inner join or append based on use case.
Troubleshooting 🔧
Problem: “Authentication failed on Zendesk node”
Cause: API credentials are missing or incorrect in Zendesk node settings.
Solution: Go to Zendesk node → Credentials → Re-enter or check your Zendesk API key and domain settings.
Problem: “No companies returned from HubSpot recently modified node”
Cause: The timestamp filter might be incorrect or no company data has changed since last execution.
Solution: Verify the cron is triggering correctly, and check the last execution timestamp value in workflow static data.
Problem: “Merge node returns empty results”
Cause: Incorrect JSON paths for matching company names.
Solution: Verify the exact JSON response structure from both HubSpot and Zendesk nodes using the n8n debug panel, adjust the paths properties.name.value and name accordingly in the Merge node.
Pre-Production Checklist ✅
- Test cron triggers manually to confirm workflow runs.
- Verify HubSpot and Zendesk API credentials with test queries.
- Confirm last execution timestamps update correctly after each run.
- Check sample data merges properly by inspecting node outputs in n8n.
- Backup existing HubSpot and Zendesk data before first sync if possible.
Deployment Guide
Activate your workflow in n8n by toggling the active switch in the top right corner. Ensure your n8n instance remains online for uninterrupted execution.
Monitor workflow executions in the n8n execution list for errors or skipped runs. Adjust cron settings if needed for system load.
Conclusion
By setting up this n8n workflow, you can automatically sync your HubSpot company changes to Zendesk without manual intervention. This reduces errors, saves hours weekly, and keeps your customer data consistent across platforms.
Next steps could include syncing contact person data, adding support ticket linking, or integrating other CRMs/tools in your stack.
Give this automation a try, and enjoy seamless data synchronization between HubSpot and Zendesk!