How to connect Odoo to n8n?
This guide shows how to connect Odoo to n8n for simple automation. You can connect Odoo to n8n by configuring Odoo credentials and using the Odoo node or XML-RPC calls in n8n. The steps below use Docker on a VPS and a PostgreSQL database.
How to connect Odoo to n8n: What You Need
- A VPS or machine with Docker installed.
- Docker and docker-compose on the VPS.
- Odoo (Docker image), PostgreSQL, and n8n.
- Odoo admin user and database name.
- Basic network access between containers or services.
Step 1: Run Odoo and PostgreSQL with Docker
Use docker-compose to run PostgreSQL and Odoo together. Save this file as docker-compose.yml on your VPS.
version: '3.1'
services:
db:
image: postgres:13
environment:
- POSTGRES_DB=postgres
- POSTGRES_PASSWORD=odoo
- POSTGRES_USER=odoo
odoo:
image: odoo:14
depends_on:
- db
ports:
- "8069:8069"
Start the services.
docker-compose up -d
Check Odoo is running on port 8069.
curl -s http://localhost:8069 | head -n 1
Step 2: Run n8n with Docker
Run a local n8n instance with basic auth for the UI. Change the user and password for production.
docker run -d --name n8n -p 5678:5678 \
-e N8N_BASIC_AUTH_ACTIVE=true \
-e N8N_BASIC_AUTH_USER=n8nuser \
-e N8N_BASIC_AUTH_PASSWORD=securepass \
n8nio/n8n
Open n8n at http://your-vps:5678 and log in with the user and password above.
Step 3: Configure Odoo credentials in n8n
Inside n8n, create new credentials for Odoo. Use the Odoo node or an HTTP Request node for XML-RPC/JSON-RPC calls.
Credential fields in n8n:
- URL: http://your-odoo-host:8069
- Database: postgres (or your DB name)
- Username: admin@example.com (Odoo user)
- Password: your-odoo-password
Test a simple read operation. Add an Odoo node or use HTTP Request to call the Odoo API.
# Example: simple JSON-RPC login test (replace values)
curl -sS -H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"call","params":{"service":"common","method":"login","args":["your-db","admin@example.com","your-odoo-password"]},"id":1}' \
http://localhost:8069/jsonrpc
Step 4: Build a basic n8n workflow
Create a trigger node (Webhook or Cron) in n8n. Add an Odoo node to read or create records. Map fields between nodes.
1. Add Webhook trigger in n8n.
2. Add Odoo node and set Operation to 'search' or 'create'.
3. Link the nodes and execute the workflow to test.
Update
To update images on the VPS use docker-compose or docker pull. Restart services after updating.
docker-compose pull
docker-compose up -d
# For n8n only:
docker pull n8nio/n8n
docker stop n8n && docker rm n8n
# then run the updated container as shown above
Security
Use HTTPS for both n8n and Odoo in production. Do not expose services without auth. Use a firewall and limit ports to needed IPs.
Create an Odoo API user with minimal rights. Rotate passwords and use VPN or SSH tunnels for internal access. Keep Docker and images updated.
Done
You now have Odoo connected to n8n on Docker. You can trigger Odoo actions from workflows and automate tasks like creating partners or syncing orders.
If you need examples for specific Odoo models or advanced XML-RPC calls, ask for a sample workflow and I will provide one.