Odoo-Unternehmensdaten über einen API-Endpunkt exportieren, mit JSON/Excel-Ausgabeoptionen

Experte

Dies ist ein CRM-Bereich Automatisierungsworkflow mit 18 Nodes. Hauptsächlich werden If, Code, Odoo, Webhook, Function und andere Nodes verwendet. Odoo-Firmendaten über API-Endpunkt exportieren, mit JSON/Excel-Ausgabeoptionen

Voraussetzungen
  • HTTP Webhook-Endpunkt (wird von n8n automatisch generiert)
Workflow-Vorschau
Visualisierung der Node-Verbindungen, mit Zoom und Pan
Workflow exportieren
Kopieren Sie die folgende JSON-Konfiguration und importieren Sie sie in n8n
{
  "meta": {
    "instanceId": "6b3e8c6c30cdfbf06283a3fa57016932c6b4ec959896c5c546ef5865ff697ff1"
  },
  "nodes": [
    {
      "id": "2b167f16-af65-4d8f-9a83-3dff9c06f99c",
      "name": "Unternehmensanfrage empfangen",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -624,
        1424
      ],
      "webhookId": "get-companies-uuid",
      "parameters": {
        "path": "/api/v1/get-companies",
        "options": {},
        "responseMode": "responseNode"
      },
      "typeVersion": 2.1
    },
    {
      "id": "b73f4dcc-6335-4458-a5d5-b6fa578dfed2",
      "name": "Dynamischen Filter vorbereiten",
      "type": "n8n-nodes-base.function",
      "position": [
        -384,
        1424
      ],
      "parameters": {
        "functionCode": "// const query = $json[\"query\"] || {}\n// const filters = []\n// if (query.name) filters.push([\"name\", \"ilike\", query.name])\n// if (query.country) filters.push([\"country_code\", \"=\", query.country])\n// const limit = query.limit ? parseInt(query.limit) : 25\n// const response_format = query.response_format || 'json'\n// return [{ json: { filters, limit, response_format } }]\n\nconst query = $json[\"query\"] || {};\n\n// Validate required 'name' parameter\nif (!query.name || query.name.trim() === \"\") {\n  return [\n    {\n      json: {\n        success: false,\n        message: \"Missing required parameter: name\",\n      },\n    },\n  ];\n}\n\nconst filters = [];\nfilters.push([\"name\", \"ilike\", query.name]); // name is mandatory\n\nconst response_format = query.response_format || \"json\";\n\nreturn [\n  {\n    json: { filters, response_format },\n  },\n];"
      },
      "typeVersion": 1
    },
    {
      "id": "5676cb5c-2ddd-46fa-88d3-3902a183f227",
      "name": "Unternehmen aus Odoo abrufen",
      "type": "n8n-nodes-base.odoo",
      "position": [
        -128,
        1424
      ],
      "parameters": {
        "options": {
          "fieldsList": [
            "display_name",
            "name",
            "email",
            "phone",
            "mobile",
            "parent_id",
            "partner_id",
            "country_code",
            "country_id"
          ]
        },
        "resource": "custom",
        "operation": "getAll",
        "returnAll": true,
        "filterRequest": {
          "filter": [
            {
              "value": "={{ $json.filters[0][2] && $json.filters[0][2].toString().trim() !== '' ? $json.filters[0][2] : \"False\" }}",
              "operator": "like",
              "fieldName": "name"
            }
          ]
        },
        "customResource": "res.company"
      },
      "credentials": {
        "odooApi": {
          "id": "rhW7JbaWT0NTawBZ",
          "name": "IMM Odoo 18"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "288b5309-6f46-484f-9ab6-06e94bd7b74f",
      "name": "Ausgabedaten vorbereiten",
      "type": "n8n-nodes-base.function",
      "position": [
        176,
        1424
      ],
      "parameters": {
        "functionCode": "if (items.length === 0 || Object.keys(items[0].json).length === 0) {\n  return [{ json: { success: false, message: 'No matching company records found' } }]\n}\nconst data = items.map(item => ({ ...item.json, report_generated_on: new Date().toISOString() }))\nreturn data.map(d => ({ json: d }))"
      },
      "typeVersion": 1
    },
    {
      "id": "cd151c5b-55ec-454a-b43d-b78a39b74441",
      "name": "Prüfen ob Excel benötigt wird",
      "type": "n8n-nodes-base.if",
      "position": [
        480,
        1424
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $('Prepare Dynamic Filter').item.json.response_format }}",
              "value2": "excel"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6b9e1c86-81c3-475a-bdda-1a44bc9aed4e",
      "name": "In Excel konvertieren",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        1104,
        1376
      ],
      "parameters": {
        "options": {},
        "operation": "xlsx"
      },
      "typeVersion": 1.1
    },
    {
      "id": "38164711-9c8c-4f7c-8e3b-3f19b1c12360",
      "name": "Mit Datei antworten",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1392,
        1376
      ],
      "parameters": {
        "options": {},
        "respondWith": "binary"
      },
      "typeVersion": 1.4
    },
    {
      "id": "cba096d5-0e19-4bec-930e-eefe587e996e",
      "name": "Mit JSON antworten",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        784,
        1776
      ],
      "parameters": {
        "options": {},
        "respondWith": "allIncomingItems"
      },
      "typeVersion": 1.4
    },
    {
      "id": "5f3f46b8-330a-4594-8170-6b2e8d68b685",
      "name": "Übersichtshinweis",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1600,
        592
      ],
      "parameters": {
        "width": 900,
        "height": 572,
        "content": "## How it works\nThis workflow provides an API endpoint `/api/v1/get-companies` that retrieves company records directly from your Odoo database. It’s built for teams who need to query or export company data — either as structured JSON for integrations or as Excel (.xlsx) for business reporting.\n\nWhen a request is made, the workflow:\n1. Accepts query parameters (`name`, `response_format`).\n2. Validates the name input (required for company search).\n3. Fetches all matching companies from Odoo using a partial `Like` filter.\n4. Returns results as a JSON response or Excel download depending on the `response_format` parameter.\n\nThis makes it ideal for quick data exports or syncing company information across systems.\n\n\n\n## Setup steps\n1. Open the Webhook node and note the endpoint `/api/v1/get-companies`.\n2. Connect your Odoo API credentials in the Odoo node.\n3. Optionally update the `fieldsList` in the Odoo node to include more company details (VAT, address, etc.).\n4. Test using a browser or Postman:  \n   - `/api/v1/get-companies?name=Tech&response_format=json`  \n   - `/api/v1/get-companies?name=Tech&response_format=excel`"
      },
      "typeVersion": 1
    },
    {
      "id": "c495e6f3-9186-41ec-8994-28ba95bde11b",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        784,
        1392
      ],
      "parameters": {
        "jsCode": "return $input.all()"
      },
      "typeVersion": 2
    },
    {
      "id": "d29068b1-e243-420b-b00c-24f9ecaa0512",
      "name": "Übersichtshinweis10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -688,
        1184
      ],
      "parameters": {
        "color": 7,
        "width": 452,
        "height": 428,
        "content": "## Request & Validation\nReceives the API request and checks for the required “name” parameter.\nReturns a validation message if missing."
      },
      "typeVersion": 1
    },
    {
      "id": "285429ca-c751-4970-85ce-27289180f9c8",
      "name": "Übersichtshinweis11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -208,
        1184
      ],
      "parameters": {
        "color": 7,
        "width": 276,
        "height": 428,
        "content": "## Search Records from Odoo\n- Queries `res.company` \n**Company Table** records in Odoo using “Like” for partial matches.\n- Customize the fields in the node options if needed.\n- **Note: Name search is case-sensitive.**"
      },
      "typeVersion": 1
    },
    {
      "id": "5f9b217d-9cf1-4a7d-b99a-c6640d38399b",
      "name": "Übersichtshinweis12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        1184
      ],
      "parameters": {
        "color": 7,
        "width": 276,
        "height": 428,
        "content": "## Prepare data and manage response json object."
      },
      "typeVersion": 1
    },
    {
      "id": "e7a97e7d-928b-4ec3-88c7-d6a2ecee9ea9",
      "name": "Übersichtshinweis13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        1184
      ],
      "parameters": {
        "color": 7,
        "width": 276,
        "height": 428,
        "content": "## Check response_format\nIf response_format=excel → returns a downloadable Excel file.\nOtherwise, returns JSON with company data."
      },
      "typeVersion": 1
    },
    {
      "id": "2d754c32-7a53-4a43-a49e-8ccf8839f6f8",
      "name": "Übersichtshinweis14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        704,
        1184
      ],
      "parameters": {
        "color": 7,
        "width": 276,
        "height": 428,
        "content": "## Prepare Data for Binary file."
      },
      "typeVersion": 1
    },
    {
      "id": "0edb17ef-3bac-42fc-835d-d67e26ad82b0",
      "name": "Übersichtshinweis15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1008,
        1184
      ],
      "parameters": {
        "color": 7,
        "width": 276,
        "height": 428,
        "content": "## Create excel file"
      },
      "typeVersion": 1
    },
    {
      "id": "6ab323ca-5cc5-4d86-b32d-17f7340a4ab2",
      "name": "Übersichtshinweis16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1312,
        1184
      ],
      "parameters": {
        "color": 7,
        "width": 276,
        "height": 428,
        "content": "## Response to web-hook with excel file."
      },
      "typeVersion": 1
    },
    {
      "id": "9d469fdf-7eaa-452f-874a-552299170c51",
      "name": "Übersichtshinweis17",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        704,
        1632
      ],
      "parameters": {
        "color": 7,
        "width": 276,
        "height": 380,
        "content": "## Response to web-hook with json object."
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "c495e6f3-9186-41ec-8994-28ba95bde11b": {
      "main": [
        [
          {
            "node": "6b9e1c86-81c3-475a-bdda-1a44bc9aed4e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6b9e1c86-81c3-475a-bdda-1a44bc9aed4e": {
      "main": [
        [
          {
            "node": "38164711-9c8c-4f7c-8e3b-3f19b1c12360",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "288b5309-6f46-484f-9ab6-06e94bd7b74f": {
      "main": [
        [
          {
            "node": "cd151c5b-55ec-454a-b43d-b78a39b74441",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b73f4dcc-6335-4458-a5d5-b6fa578dfed2": {
      "main": [
        [
          {
            "node": "5676cb5c-2ddd-46fa-88d3-3902a183f227",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "cd151c5b-55ec-454a-b43d-b78a39b74441": {
      "main": [
        [
          {
            "node": "c495e6f3-9186-41ec-8994-28ba95bde11b",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "cba096d5-0e19-4bec-930e-eefe587e996e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2b167f16-af65-4d8f-9a83-3dff9c06f99c": {
      "main": [
        [
          {
            "node": "b73f4dcc-6335-4458-a5d5-b6fa578dfed2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5676cb5c-2ddd-46fa-88d3-3902a183f227": {
      "main": [
        [
          {
            "node": "288b5309-6f46-484f-9ab6-06e94bd7b74f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Häufig gestellte Fragen

Wie verwende ich diesen Workflow?

Kopieren Sie den obigen JSON-Code, erstellen Sie einen neuen Workflow in Ihrer n8n-Instanz und wählen Sie "Aus JSON importieren". Fügen Sie die Konfiguration ein und passen Sie die Anmeldedaten nach Bedarf an.

Für welche Szenarien ist dieser Workflow geeignet?

Experte - Kundenbeziehungsmanagement

Ist es kostenpflichtig?

Dieser Workflow ist völlig kostenlos. Beachten Sie jedoch, dass Drittanbieterdienste (wie OpenAI API), die im Workflow verwendet werden, möglicherweise kostenpflichtig sind.

Workflow-Informationen
Schwierigkeitsgrad
Experte
Anzahl der Nodes18
Kategorie1
Node-Typen8
Schwierigkeitsbeschreibung

Für fortgeschrittene Benutzer, komplexe Workflows mit 16+ Nodes

Autor
V3 Code Studio

V3 Code Studio

@v3codestudio

🚀 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.

Externe Links
Auf n8n.io ansehen

Diesen Workflow teilen

Kategorien

Kategorien: 34