Verify customs shipping documents with GPT-4o-mini, Gmail and Slack

Quick overview This workflow receives shipment document text via a webhook, uses OpenAI (GPT-4o-mini) to extract key fields from the Bill of Lading, cross-checks the extracted data against Invoice and Packing List fields, then emails a compliance verdict via Gmail and sends failure alerts to Slack.

How it works Receives a POST request via webhook containing submitterEmail, shipmentRef, and the plain-text Commercial Invoice, Packing List, and Bill of Lading. Uses OpenAI (GPT-4o-mini) to extract structured Bill of Lading fields into JSON, and posts a Slack alert if the extraction fails. Compares key fields across the Invoice, Packing List, and Bill of Lading (for example consignee/shipper names, ports, package counts, gross weight, HS codes, quantities, and shipping marks) and calculates a verdict and discrepancy list. Emails a “READY_TO_FILE” report via Gmail when all checks pass. Emails a “NEEDS_CORRECTION” report via Gmail with detailed mismatch explanations and check IDs when discrepancies are found. Sends a Slack message when any workflow-level error occurs so issues are visible even if the run fails early.

Setup Add an OpenAI credential and ensure the OpenAI node is configured to use your model access (GPT-4o-mini). Add a Gmail OAuth2 credential and confirm the recipient field uses the incoming submitterEmail value. Add a Slack OAuth2 credential and set the target channel ID for both Slack alert steps. Copy the production webhook URL and configure your source system to POST JSON with submitterEmail, shipmentRef, invoiceText, packingText, and bolText.

0
Downloads
0
Views
8.58
Quality Score
beginner
Complexity
Author:Rahul Joshi(View Original →)
Created:7/19/2026
Updated:7/20/2026

🔒 Please log in to import templates to n8n and favorite templates

Workflow Visualization

Loading...

Preparing workflow renderer

Comments (0)

Login to post comments