Webhooks¶
With webhooks, Shopify tells Odoo when a product, customer or order changes, and Odoo imports it within minutes instead of waiting for the next scheduler.
flowchart LR
S[Change on Shopify] -- event --> I[Received Events<br/>in Odoo]
I -- queued --> J[Sync job line:<br/>reads the record from Shopify]
J --> O[Product, customer<br/>or order updated]
Odoo answers Shopify at once and processes the event in the background. It never trusts the event's content: it reads the record again from Shopify by its ID, so the result is the same as an import.
Requirements¶
- Odoo reachable from the internet on HTTPS.
- The correct Secret Key on the store: Shopify signs each event with it, and Odoo refuses events with a wrong signature (a red box offers Correct Secret).
Register the webhooks¶
- Open the store, click Configuration, then Webhooks.
- Check the Webhook Address: it must start with
https://and be your public address. If it is wrong, fill in Public URL (e.g.https://erp.yourcompany.com). - Switch on the events you want.
- Click Register Webhooks.
| Event | What Odoo does |
|---|---|
| Product Created, Product Updated | Imports the product, like Import Products. |
| Product Deleted | Removes it from the store layer; the Odoo product stays. |
| Customer Created, Customer Updated | Imports the customer. |
| Customer Deleted | The customer loses its link; the contact stays. |
| Order Created / Updated | Imports the new order, or applies the change: paid, fulfilled, cancelled, refunded, edited, location changed. |
| Order Deleted | Marks the Odoo order Needs Attention. |
| App Uninstalled | Marks the store Connection to the store lost. |
Each row shows its Status (Not Registered, Active, Error, Other Database), Last Received and Last Error.
| Button | What it does |
|---|---|
| Register Webhooks | Creates the switched-on events on Shopify and removes the switched-off ones. |
| Check on Store | Compares with the webhooks that exist on Shopify. |
| Remove from Store | Removes all webhooks of this store from Shopify and switches every event off. |
| Received Events | The events received, with their status. |
Keep a scheduler as a safety net
Shopify does not guarantee every event. Keep a daily Import Orders scheduler: it catches what a missed event would have brought.
Checked every day
Odoo checks the webhooks of connected stores every day and registers again those Shopify dropped.
Copies of the database¶
A webhook belongs to the database that registered it. When a copy of production (test, staging) finds webhooks that send to another database, it shows a red box:
- On the copy: click Disable Here. Nothing changes on Shopify.
- On the database that should receive the events (e.g. production after a move): click Take Over.
Never Take Over from a copy
Take Over sends Shopify's events to this database; the other address stops receiving them. On a copy of production, it would stop your live orders from reaching production.
Received Events¶
Shopify › Activity › Received Events lists every event received: Pending, Queued, Done, Ignored (e.g. a change Odoo itself made) or Failed. A second delivery of the same event is ignored.