How to integrate Zapier with Odoo CRM API for creating prospects automatically

I need help setting up an integration between Zapier and Odoo CRM using webhooks to automatically create new prospects when data comes from social media advertising platforms.

I’ve decided not to use Zapier’s built-in Odoo connector because it doesn’t support all the fields I need to map, specifically Campaign information, Lead Source, and custom Notes. Using a webhook approach would give me more control over the data transfer.

I’m pretty new to working with APIs and webhook integrations. I managed to successfully authenticate with Odoo using the session endpoint at .../web/session/authenticate with this payload:

{
  "jsonrpc": "2.0",
  "params": {
    "database": "my_database",
    "username": "user_email",
    "password": "user_password"
  }
}

The authentication works fine and I get a successful response, but I’m stuck on the next step. What endpoint should I call to actually create the lead record? What parameters and data structure does Odoo expect for creating new CRM prospects?

Any examples or guidance would be really helpful since I want to make sure I’m sending the right data format.

The approach mentioned above works, but there’s actually a cleaner way to handle this through Odoo’s REST API if you’re already authenticating via session. Instead of the execute_kw method, you can directly post to /web/dataset/call_kw/crm.lead/create which I found more straightforward when I built something similar.

Your JSON payload structure would be:

{
  "jsonrpc": "2.0",
  "method": "call",
  "params": {
    "model": "crm.lead",
    "method": "create",
    "args": [{
      "name": "Prospect Name",
      "email_from": "[email protected]",
      "source_id": 1,
      "campaign_id": 2,
      "description": "Notes from social media campaign"
    }],
    "kwargs": {}
  }
}

One thing to watch out for - you’ll need to handle the session cookies properly between your authentication call and the lead creation call. I recommend testing this in Postman first to make sure your cookie handling is working correctly before implementing it in Zapier’s webhook setup.

Once you have your session authenticated, you’ll want to use the /web/dataset/call_kw endpoint to create the lead record. I ran into similar issues when setting this up last year and found that this endpoint gives you the flexibility you’re looking for. The key is structuring your request properly. You’ll need to target the crm.lead model with the create method. Your payload should look something like this:

{
  "jsonrpc": "2.0",
  "method": "call",
  "params": {
    "service": "object",
    "method": "execute_kw",
    "args": [
      "your_database",
      "your_user_id",
      "your_password",
      "crm.lead",
      "create",
      [{
        "name": "Lead Name",
        "email_from": "[email protected]",
        "phone": "+1234567890",
        "source_id": "your_source_id",
        "campaign_id": "your_campaign_id",
        "description": "Your custom notes"
      }]
    ]
  }
}

Make sure to get the correct IDs for your campaign and source fields beforehand by querying those models first. The response will include the newly created lead ID if successful.

just a heads up - you might want to check odoo’s api documentation for field requirements first. when i did this integration few months ago i kept getting errors becuase some fields like ‘partner_id’ are required depending on your odoo configuration. also make sure to handle the response properly since odoo sometimes returns validation errors that arent immediately obvious from the json response.