Odoo Customer Data Fetch and Dynamic Export API - n8n Workflow

Use this efficient n8n workflow to create a dynamic API endpoint for fetching Odoo customer records. Export data directly to JSON or Excel (.xlsx) using a single n8n trigger.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Business Analysts needing on-demand, filtered customer data exports.
Integration Specialists building microservices around Odoo.
Developers looking for robust n8n templates for API creation and conditional file handling.
Users who need to search Odoo contacts via a simple, external n8n API.

Overview

This comprehensive n8n workflow addresses the common requirement of needing quick, targeted access to backend ERP data (Odoo) without building complex middleware. It sets up a dedicated webhook n8n trigger that accepts search criteria (customer name) and an output format (JSON or Excel).

The core value provided by this n8n automation is its dynamic dual output capability. After fetching matching records using the Odoo n8n node, the flow uses conditional logic to decide whether to serialize the data into a standard JSON response (ideal for system integration) or convert it into a downloadable .xlsx file (perfect for manual reporting and analysis). Utilizing a custom n8n node for validation ensures that all necessary parameters are supplied before querying Odoo, making this n8n workflow reliable and efficient.

How it Works

The entire process is initiated by the Receive Company Request1 n8n trigger, which is a Webhook exposed as an API endpoint.


  1. Request Reception and Validation: The webhook receives a request (e.g., including name and responseformat). The Prepare Dynamic Filter1 n8n node validates that the required name parameter is present. If not, it immediately returns an error response.

  2. Odoo Data Fetch: If validation passes, the Fetch Customer Odoo n8n node queries the res.partner table using a dynamic 'Like' filter based on the input name, retrieving specified customer fields.

  3. Data Preparation: The Prepare Output Data1 n8n node processes the results, appending a reportgeneratedon timestamp and handling scenarios where no records were found.

  4. Conditional Routing: The Check If Excel Required1 n8n node uses an If statement to analyze the requested responseformat.

  5. Excel Output Path (If True): If 'excel' is requested, the data is passed to a Code n8n node to prepare all items for the Convert to Excel1 n8n node, which generates the binary .xlsx file. Finally, Respond with File1 returns this binary file to the requester.

  6. JSON Output Path (If False): If 'json' is requested (or is the default), Respond with JSON1 directly returns the prepared customer data objects in JSON format. This robust conditional logic showcases the power of this versatile n8n workflow.

Installation Guide


  1. Importing the n8n Workflow: Copy the provided JSON data and import it directly into your n8n instance via the 'New' menu and 'Import from JSON'.

  2. Odoo Credentials: Locate the Fetch Customer Odoo n8n node. You must set up or select existing Odoo API credentials (including your instance URL, username, API Key/Password).

  3. Webhook Setup: The Receive Company Request1 n8n trigger is pre-configured with the path /api/v1/get-customers. Save the workflow and activate it to get the unique webhook URL.

  4. Testing: Test the n8n workflow using tools like Postman or a browser. Example endpoint calls are:

YOURN8NURL/webhook/api/v1/get-customers?name=John&responseformat=json
YOUR
N8NURL/webhook/api/v1/get-customers?name=John&responseformat=excel

Node Details

Receive Company Request1 (Webhook n8n trigger):
Function: Starts the n8n workflow upon receiving an HTTP request.
Key Configuration: Path set to /api/v1/get-customers. Response mode is set to use a subsequent response node.
Prepare Dynamic Filter1 (Function n8n node):
Function: Validates the required name query parameter and constructs the necessary filter array for the Odoo API call. Returns an immediate error if name is missing.
Key Configuration: Custom JavaScript logic enforces parameter validation and extracts responseformat.
Fetch Customer (Odoo n8n node):
Function: Connects to Odoo to retrieve customer records (res.partner).
Key Configuration: Operation set to getAll, using a dynamic Like filter expression based on the output of the previous n8n node.
Check If Excel Required1 (If n8n node):
Function: Controls the flow based on the requested output format.
Key Configuration: Checks if response
format equals 'excel'.
Convert to Excel1 (Convert to File n8n node):
Function: Converts the incoming JSON array of customer objects into a binary .xlsx file.
Key Configuration: Operation is set to xlsx (Excel).
Respond with File1 / Respond with JSON1 (Respond to Webhook n8n node):
* Function: Terminates the n8n workflow and sends the appropriate response back to the requester (either a binary file or structured JSON data).

Related n8n Workflows

Free

Nodes: 8 Nodes
Updated: December 26 2025
View all
Created by
V3 Code Studio
V3 Code Studio

🚀 AI & Automation Expert | n8n Creator | Workflow Specialist | Automation Specialist | V3 Code Studio I build smart automation workflows with n8n to help businesses streamline operations, save time, and increase productivity. Passionate about no-code/low-code automation and AI-driven solutions that make processes efficient, scalable, and growth-oriented.

Featured*