Platform
Chatbot Builder Bulk Messaging Team Inbox Mini CRM API & Webhooks AI Integration WhatsApp Flows
Industries
E-commerce & D2C Real Estate Education Healthcare Finance & BFSI Logistics Hospitality Retail
Integrations 📚 Learn 🗂 Codex Compare Pricing About Contact Start Free Trial →
Technical Guide Step-by-Step ⏱ 15 min read

Connect Odoo ERP to WhatsApp API — 4 Methods with Python Code

Odoo is the most popular open-source ERP in India — used for manufacturing, trading, services, and retail. WA.Expert connects Odoo events — sales orders, invoices, delivery orders, manufacturing orders — to WhatsApp via Odoo Automated Actions, custom Python modules, or Odoo's XML-RPC external API.

Get WA.Expert API Key → Talk to a Developer

What this guide covers

Odoo's open-source nature gives you multiple integration paths. Odoo 16 and 17 even have a native WhatsApp module — but it requires a Meta direct account. WA.Expert provides an alternative that's often simpler for Indian businesses. This guide covers all four methods so you can choose based on your Odoo version and technical skill.

Integration approachComplexityBest for
Odoo Automated Actions (no code)⭐ Easy — Odoo admin knowledgeSet trigger on model event + Server Action calling WA.Expert API.
Custom Odoo Python Module⭐⭐⭐ Complex — Odoo developerOverride _create/_write methods to fire WhatsApp on document events.
Odoo XML-RPC / JSON-RPC (external)⭐⭐ Medium — external Python/Node.jsExternal script polls Odoo API for new records and triggers WhatsApp.
Odoo Native WhatsApp Module (v16/17)⭐ Easy — requires Meta Business accountOdoo 16/17 built-in WhatsApp module — configure with WA.Expert BSP credentials.

How to connect — all methods explained

Method 1 Odoo Automated Actions — No-Code Method

1

Open Automated Actions

In Odoo: Settings → Technical → Automation → Automated Actions. Enable developer mode (Settings → Activate Developer Mode) if Automated Actions is not visible.

2

Create new Automated Action

Name: "WhatsApp on Sale Order Confirm". Model: Sales Order (sale.order). Trigger: Stage is set to "Sales Order". Action: Execute Python Code.

3

Write the Python action code

In the Python Code field, write the HTTP request to WA.Expert. Odoo's action code has access to the record via the variable "records". Use Python's requests library (import requests) or Odoo's built-in urllib.request.

4

Map Odoo fields to WhatsApp variables

Access: record.partner_id.mobile or record.partner_id.phone for phone, record.name for order number, record.amount_total for amount, record.partner_id.name for customer name.

5

Test and activate

Save and click "Run Manually" on a test Sale Order to verify. Check Python execution errors in Settings → Technical → Logging. Once verified, the action fires automatically on all matching records.

# Odoo Automated Action — Python Code # Trigger: Sale Order confirmed (state = sale) # Access: variable "records" contains matching records import urllib.request, json for record in records: phone = record.partner_id.mobile or record.partner_id.phone if not phone: continue payload = json.dumps({ "to": phone, "template": "odoo_so_confirm", "variables": { "name": record.partner_id.name, "order": record.name, "amount": str(record.amount_total) } }).encode() req = urllib.request.Request( "https://api.wa.expert/v1/send", data=payload, headers={"Authorization": "Bearer YOUR_KEY", "Content-Type": "application/json"}, method="POST" ) urllib.request.urlopen(req)

In Odoo Automated Actions, the requests library is not available by default in sandboxed code. Use Python's built-in urllib.request instead (as shown) for HTTP calls — this always works regardless of Odoo version or server configuration.

Method 2 Odoo XML-RPC External Integration

1

Connect to Odoo via XML-RPC

Odoo exposes an XML-RPC interface at /xmlrpc/2/common (authentication) and /xmlrpc/2/object (data). Use Python's xmlrpc.client (built-in) to authenticate and query models.

2

Authenticate and get uid

Call common.authenticate(db, username, password, {}) to get the user ID (uid). Use this uid + password for all subsequent object calls.

3

Query for new records

Use models.execute_kw(db, uid, password, model, "search_read", filters, fields) to query for records created since last run. Store the last processed write_date to avoid reprocessing.

4

Extract phone and call WA.Expert

From the record data, get partner_id and load the partner's mobile field. Call WA.Expert API with the phone and document details.

# Odoo XML-RPC → WA.Expert (external script) import xmlrpc.client, requests from datetime import datetime, timedelta url = "https://your-odoo.com" db, user, pwd = "mydb", "admin", "password" common = xmlrpc.client.ServerProxy(f"{url}/xmlrpc/2/common") uid = common.authenticate(db, user, pwd, {}) models = xmlrpc.client.ServerProxy(f"{url}/xmlrpc/2/object") # Find new invoices in last 10 minutes since = (datetime.now() - timedelta(minutes=10)).strftime("%Y-%m-%d %H:%M:%S") invoices = models.execute_kw(db, uid, pwd, 'account.move', 'search_read', [[[ 'write_date', '>', since], ['move_type', '=', 'out_invoice'], ['state', '=', 'posted']]], {'fields': ['name','partner_id','amount_total']}) for inv in invoices: partner = models.execute_kw(db, uid, pwd, 'res.partner', 'read', [inv['partner_id'][0]], {'fields':['mobile','name']})[0] if partner['mobile']: # call WA.Expert API pass

Common questions

Does Odoo 16/17 have a built-in WhatsApp module?
Yes — Odoo 16 and 17 include a native WhatsApp Business module. It connects directly to Meta's Cloud API. To use WA.Expert with Odoo's native module, configure WA.Expert as the API provider by entering your WA.Expert WABA phone number ID and API token in the Odoo WhatsApp configuration. This gives you Odoo's native UI with WA.Expert's template management and analytics.
What Odoo models are most useful for WhatsApp integration?
High-value Odoo models for WhatsApp: sale.order (Sales Orders), account.move (Invoices and Bills), stock.picking (Delivery Orders and Receipts), purchase.order (Purchase Orders), crm.lead (CRM Leads and Opportunities), mrp.production (Manufacturing Orders). Each model has a partner_id field linking to the customer/vendor contact with phone number.
How do I store WhatsApp numbers in Odoo contacts?
Odoo's res.partner model has phone and mobile fields. Best practice: use the mobile field for WhatsApp numbers. If you need to distinguish between regular mobile and WhatsApp number, add a custom field (x_whatsapp_number) via Settings → Technical → Database Structure → Fields. Alternatively, use the comment field convention: "WA: 9876543210".
Can Odoo automated actions fire for delivery/shipping events?
Yes — create an Automated Action on stock.picking (Transfer) model. Trigger when the state field changes to "done" (delivery completed). The partner_id on the picking links to the customer. Extract mobile phone and fire a WhatsApp delivery confirmation.
Is the XML-RPC approach real-time or delayed?
XML-RPC from an external script is polling-based — you check Odoo every few minutes for new records. This introduces a delay (typically 1–10 minutes). For real-time WhatsApp, use Odoo Automated Actions (fires immediately when the record state changes) or a custom Odoo Python module that overrides the model's create/write methods.
Can I use n8n or Make to connect Odoo to WhatsApp?
Yes — both n8n and Make have Odoo nodes that connect via XML-RPC/JSON-RPC. n8n's Odoo node supports read, create, update, and delete operations on any Odoo model. Set up a periodic trigger (every 5 minutes) that reads new sales orders from Odoo and sends WhatsApp via WA.Expert HTTP request node. This is the recommended approach for non-Odoo developers.

More connection guides

Ready to connect Odoo to WhatsApp?

Automated Actions get you live in 30 minutes. Custom modules give you full control. WA.Expert handles the WhatsApp delivery.

Start Free Trial → Talk to a Developer