webhooks

Estimated reading: 2 minutes 59 views

Introduction

Webhooks in Odoo allow you to automate actions in your Odoo database whenever a specific event occurs in another system.
 Instead of polling for updates at fixed intervals (like scheduled actions) or triggering them manually (like API calls), webhooks enable real-time, event-driven automation.

Step-by-Step Instructions

 

1. Create a Webhook in Odoo Studio

  1. Preparation
    1. Activate Developer Mode (optional but recommended) to see technical names of models and fields.
    2. Use a test/duplicate database before going live.
  2. Open Studio → Webhooks → New
  3. Name the Webhook clearly (e.g., “Update Inventory from POS”).
  4. Select Model (in Developer Mode you can choose; otherwise, defaults to current model).
  5. Webhook URL:
    1. Generated automatically.
    2. Can be rotated if needed (update external systems if changed).
    3. Keep it confidential.
  6. Enable Log Calls (optional, for troubleshooting).
  7. Target Record Code:
    1. If external system is Odoo: ensure id and model are in payload.
    2. If non-Odoo: parse JSON payload accordingly.
  8. Actions To Do:
    1. Click Add an action and define what should happen (Update Record, Execute Code, etc.).
  9. Save & Test before implementing.

 

2. Test a Webhook

Using Postman:

  1. Create new POST
  2. Paste Webhook URL in Postman.
  3. Go to Body → raw → JSON.
  4. Paste test payload.
  5. Click Send.
  6. Look for:
    1. 200 OK or “status”: “ok” → works fine.
    2. Error codes → fix payload mapping or Odoo settings.

3. Implement in External System

  • Configure the external system to send POST requests to Odoo’s webhook URL.
  • Ensure payload format matches what Odoo expects.

Tips

  • Use Developer Mode to quickly get technical names of models and fields.
  • Turn on Log Calls for debugging.
  • Always test in a duplicate database before deploying to production.
  • Keep webhook URLs private to prevent unauthorized access.
  • For creating records, prefer:

env[‘model.name’].create({…})

instead of directly manipulating target record.

Key Benefits

  • Real-time updates between systems.
  • No coding required for basic Odoo-to-Odoo integrations.
  • Works across multiple apps (Sales, Inventory, CRM, etc.).
  • Reduces manual data entry and errors.
  • Can integrate with non-Odoo systems (ERP, POS, CRMs).

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Learn how we helped 100 top brands gain success