Sending postcards from Odoo CRM can be done with the Zapier integration we have developed. Every time a new lead is created in Odoo CRM, a personalized postcard can be sent via the Print.one API.
Below is a step-by-step guide to setting up a webhook in Odoo CRM to send a JSON payload to the Print.one API.
Ensure you have access to your Odoo CRM instance with sufficient administrative privileges.
Obtain your API key from Print.one. Use a TEST API key for testing and a LIVE API key for production.
Log in to your Odoo CRM account using your credentials.
Enable Developer Mode in Odoo to access advanced settings:
Go to the top-right corner of the interface.
Click your profile and select
Activate the Developer Mode
(or similar, depending on your Odoo version).
Navigate to Settings → Technical → Automation → Automated Actions.
Click Create to add a new automated action.
Fill in the following details for the automated action:
Name: Enter a name for the action, such as "Send to Print.one API".
Model: Select the Odoo model associated with the webhook (e.g., "Lead/Opportunity" for CRM leads).
Trigger Condition: Choose when the webhook should be triggered, e.g.:
On Creation
On Update
On Deletion
Apply On: Specify any additional conditions (optional), such as filtering by lead stage.
Under the Action To Do section, select Execute Python Code.
Paste the following Python code to perform the webhook call:
Replace YOUR_API_KEY
with your Print.one API key.
Modify the product_id
and other fields as needed to match your Print.one setup.
Save the automated action.
Test the webhook:
Create or update a record in Odoo CRM that matches the trigger condition.
Check in Print.one if the order was received correctly.
If using a TEST API key, the order will not be printed or shipped, but a PDF will be generated.
If using a LIVE API key, the order will be printed and shipped.
If the webhook doesn’t work as expected, check the following:
API Key: Ensure the X-API-KEY
header contains the correct API key (TEST for testing, LIVE for production).
JSON Payload: Verify the structure of the payload and that it includes the correct data.
URL: Confirm the URL is set to https://api.print.one/v2/orders
.
Automated Action: Ensure the action triggers on the appropriate events in Odoo.
Python Code: Check for syntax errors or missing fields in the code.
Once you’ve confirmed the webhook works with the TEST API key:
Replace the TEST API key with your LIVE API key in the Python code.
Run the test again to ensure everything functions correctly.