Pull live customer data from your Odoo database into a WhatsApp chatbot. Search the res.partner model by phone number, fetch customer details and account history, and reply with ERP context in real time.
Before following this guide, read the External API Request step foundation guide. It covers every field in the step interface so this guide can focus on Odoo-specific values.
Odoo has three API protocols (XML-RPC, JSON-RPC, REST). This guide uses the REST API with Bearer token, available from Odoo 16+. It is the cleanest method for WA.Expert integration. If you are on Odoo 14 or 15, see the JSON-RPC alternative in the troubleshooting section below.
Odoo API keys are tied to a specific user and inherit that user's access permissions. Generate one for a dedicated integration user to keep the connection auditable and revocable.
yourcompany.odoo.com) and database name if your instance hosts multiple databases.If you do not see the API Keys tab, your Odoo version may be older than 16, or the feature may be disabled. In Odoo 14/15, enable it via Settings > Technical > Allow API Keys. On very old versions, use JSON-RPC with username and password instead.
Odoo external API: odoo.com/documentation/19.0/developer/reference/external_api.html
In your WA.Expert chatbot flow, store the customer's phone as {{customer_phone}}. Add an External API Request step to search the Odoo partner model:
| Field | Value | Notes |
|---|---|---|
| Select Method | GET | Searching for partner records. |
| Request URL | https://yourcompany.odoo.com/api/res.partner?domain=[...]&fields=[...] | Replace yourcompany.odoo.com with your Odoo URL. The domain parameter is a JSON array filter condition. The fields parameter lists what to return. |
| Authorization | Bearer YOUR_ODOO_API_KEY | Standard Bearer token. Paste the key from Step 1 after 'Bearer '. |
| Content-Type | application/json | Required for Odoo REST API requests. |
| X-Odoo-Database | your_database_name | Required ONLY if your Odoo server hosts multiple databases. Single-database instances do not need this header. Find the name in Settings > General Settings. |
| Select Body Type | None | GET requests carry no body. |
| Choose Response Type | JSON | Odoo returns an array of partner objects. |
Odoo domain filters are JSON arrays of conditions. Each condition is a three-element array: ["field", "operator", "value"].
| What you want | Domain filter |
|---|---|
| Contact by phone | [["phone","=","9820000001"]] |
| Contact by mobile | [["mobile","=","9820000001"]] |
| Phone or mobile (OR) | ["|", ["phone","=","9820000001"], ["mobile","=","9820000001"]] |
| Customers only (not all contacts) | [["customer_rank",">",0]] |
| Customer by phone | [["phone","=","9820000001"],["customer_rank",">",0]] |
The | operator in Odoo domain is a prefix OR. Put it before the two conditions it joins. Without customer_rank filter, the search returns all contacts including suppliers and employees.
A successful Odoo partner search response looks like this:
[
{
"id": 142,
"name": "Priya Sharma",
"email": "priya@example.com",
"phone": "9820000001",
"mobile": "+919820000001",
"street": "12 MG Road",
"city": "Mumbai",
"customer_rank": 3,
"supplier_rank": 0
}
]Odoo's REST API returns partner records as a plain array, not wrapped in a 'data', 'value', or 'response' object. Map your variables using [0].name, [0].email, [0].city directly. If the array is empty, no partner was found with that phone number.
Map these response paths to variables in the External API Request step:
| Variable name | Response path | Example value |
|---|---|---|
| partner_id | [0].id | 142 |
| customer_name | [0].name | Priya Sharma |
| customer_email | [0].email | priya@example.com |
| customer_city | [0].city | Mumbai |
| customer_rank | [0].customer_rank | 3 (higher = more orders placed) |
customer_rank is a count of how many sales orders the partner has placed. Higher values mean longer-standing customers. Use it to personalise replies: 'Welcome back, valued customer' vs 'Welcome, new customer'.
If the customer messaged you first within the last 24 hours, your reply is a free service conversation. For proactive outbound messages from Odoo data, use an approved Utility or Marketing template.
Customer messages your WhatsApp number.
WA.Expert captures their phone as {{customer_phone}} = "9820000001".
External API Request step:
GET https://yourcompany.odoo.com/api/res.partner
?domain=[["phone","=","9820000001"]]
&fields=["name","city","customer_rank","email"]
Authorization: Bearer YOUR_ODOO_API_KEY
Response (array):
[{
"id": 142,
"name": "Priya Sharma",
"city": "Mumbai",
"customer_rank": 3,
"email": "priya@example.com"
}]
Mapped:
customer_name = "Priya Sharma"
customer_city = "Mumbai"
customer_rank = "3"
Conditions: if array is empty → "We could not find your record."
Bot replies (if found):
"Hi Priya Sharma, welcome back!
Account city: Mumbai
You have placed 3 orders with us.
Reply ORDERS to check your latest order status,
or reply SUPPORT for assistance."If you are on Odoo 14 or 15 and cannot use the REST API, the JSON-RPC method works on all Odoo versions. It is a two-step POST process:
Step 1: Authenticate to get user ID
POST https://yourcompany.odoo.com/web/session/authenticate
Content-Type: application/json
Body:
{
"jsonrpc": "2.0",
"method": "call",
"params": {
"db": "your_database_name",
"login": "your@email.com",
"password": "your_password_or_api_key"
}
}
Response: { "result": { "uid": 7, ... } } ← store uid
Step 2: Search res.partner
POST https://yourcompany.odoo.com/web/dataset/call_kw
Content-Type: application/json
Body:
{
"jsonrpc": "2.0",
"method": "call",
"params": {
"model": "res.partner",
"method": "search_read",
"args": [[ ["phone", "=", "9820000001"] ]],
"kwargs": {
"fields": ["name", "email", "city", "customer_rank"],
"limit": 1
}
}
}
Response: { "result": [{ "id": 142, "name": "Priya Sharma", ... }] }
Map: result[0].name, result[0].city| Symptom | Likely cause | Fix |
|---|---|---|
| 401 Unauthorized | Wrong API key or missing Bearer prefix | Check the Authorization header reads exactly 'Bearer YOUR_API_KEY'. Regenerate the key in Settings > Users > API Keys if needed. |
| Database not found / 404 | Multi-database instance without X-Odoo-Database header | Add the X-Odoo-Database header with your exact database name. Find it in Settings > General Settings. |
| Empty array [] | Phone number format mismatch | Check if numbers are stored with country code (+91...) or without. Try ?domain=[["mobile","=","9820000001"]] to search the mobile field instead. |
| API Keys tab missing | Older Odoo version or feature disabled | On Odoo 14/15: Settings > Technical > Allow API Keys. On older: use JSON-RPC with username/password as shown above. |
| Access Denied on model | API user lacks read permission for res.partner | In Odoo Settings > Users, ensure the integration user has at least a 'User' role in the Sales or CRM module which grants contact read access. |
| 429 Too Many Requests | Rate limit hit (Odoo SaaS: ~60 req/min) | Add a delay before retrying. For a WhatsApp bot doing single lookups, this limit is very generous. |
Salesforce SOQL queries with Azure-style two-step auth.
Read guide →Microsoft Dynamics 365 with Azure AD OAuth and OData filters.
Read guide →Master every field in WA.Expert's HTTP action step.
Read foundation guide →Free trial, no credit card required. And if you ever get stuck, we are the only platform in India that answers you live on WhatsApp.