top of page

AI for Freight Forwarder - AI Agent Extract Booking PDF to Odoo

  • Writer: Bernard Bryan Hayashi
    Bernard Bryan Hayashi
  • Feb 25
  • 3 min read

Overview


In the freight forwarding industry, booking documents are still commonly exchanged in PDF format via email. These PDFs often contain critical information such as shipper details, consignee, ports, container types, ETD/ETA, and cargo descriptions. Unfortunately, this information is unstructured, meaning it cannot be directly consumed by ERP systems like Odoo without manual data entry.


This blog explains why and how we can use an AI-powered workflow to automatically extract booking information from PDF files and prepare it for integration into Odoo. The approach significantly reduces manual work, minimizes human error, and speeds up booking processing.



Why Do We Need This Workflow?


1. Manual Data Entry Is Inefficient

Freight operators often need to manually read PDFs and retype the information into Odoo. This process is:

  • Time-consuming

  • Error-prone

  • Not scalable when booking volume increases


2. PDF Files Are Unstructured

Most booking confirmations are not machine-readable tables. Even when text-based, layouts vary between shipping lines and agents, making traditional rule-based extraction unreliable.


3. AI Can Understand Context

By combining PDF text extraction with Large Language Models (LLMs), we can:

  • Extract text from PDF file

  • Identify relevant booking fields

  • Retrieve booking data in a structured JSON format suitable for Freight Booking API



High-Level Architecture


  1. PDF file (Booking Confirmation)

  2. n8n workflow to orchestrate automation

  3. AI model (using Ollama) for identifying and retrieving specific booking fields

  4. Odoo as the final destination system



Software & Tools Required


Before starting, make sure the following software is installed and configured:

1. Docker

Used to run n8n locally in a containerized environment.

2. n8n (Self-hosted)

An open-source workflow automation tool used to design and execute the PDF extraction pipeline.

3. Ollama

Runs local LLM models (e.g., Qwen3)

4. Odoo (Target System)

ERP system where the extracted booking data will eventually be inserted (Sales Order / Shipment / Booking module).



Step-by-Step Workflow Setup in n8n


  1. Click “or start from a template” to faster the workflow creation

  2. Click “See more templates”

  3. Search for “extract pdf file”

  4. Click the “Extract text from a PDF file” template

  5. Click “Use for free” button

  6. Click “Copy template to clipboard (JSON)” then create a new .json file and paste the copied json to the json file

  7. Open your new workflow and click the three dots icon and click “Import from File…” then upload the json file

  8. You can start modifying the workflow template

  9. Double click the “Read Binary File” node and change the “File Path” to your pdf file path (please refer to Local N8N Installation Using Docker blog for the path file)

  10. Click the “Execute step” button to test if the node can read the file path correctly

  11. Click “Execute Workflow” button to ensure all nodes run correctly

  12. Double click the “Read PDF” node and check whether the output generates a JSON containing the text of the PDF file

  13. Add a new node by clicking the plus icon on the right side of the last node, then choose “Core” => “Code” => “Code in JavaScript”


  14. Add this new node to sanitize the extracted text

  15. Execute the node, and it should return the sanitized text

  16. Add another “Code in JavaScript” node to return a JSON object containing an array of strings. These ports will be used to map the port names from the PDF with the available ports in the database.

  17. Execute the node, and it should return an object containing an array of available ports

  18. Add a new node “Core” => “HTTP Resquest” to call Ollama API and access the Qwen3 model. Use the request method, url, headers, and body as shown in the screenshots below. This request will extract booking pdf information and generate a suitable JSON for the Freight Booking API

  19. Create a new “HTTP Request” node to generate a Session ID. This Session ID will be used for the Freight Booking Create API request

  20. Create another “HTTP Request” node to create a dummy booking record

  21. Congrats the booking record has been successfully created



 
 
 

Recent Posts

See All
eInvoice Malaysia FAQ

For employee expenses claim, such as Petrol, fuel, travelling, etc, do you need to do self-billed. No. Employee expenses still can be claimed as usual, without the company name. If my company is buyin

 
 
 

Comments


Subscribe Form

  • facebook
  • linkedin

©2019 by Excelroot Technology Sdn Bhd.

bottom of page