PO email to draft order
Watches a mailbox for purchase order PDFs and turns each one into a draft order in Propeller, with the customer matched, the products matched and the PO reference filled in. A sales rep only has to review and confirm.
Runs: Outside Propeller · Trigger: Email · Difficulty: Medium
What you need
- An n8n account. See Set up n8n.
- A Gmail account for the mailbox that receives the purchase orders.
- An OpenAI account.
- A Propeller API key.
How it works
Every minute the workflow checks the mailbox for emails with a PDF attachment and handles them one by one. For each email:
- AI reads the PDF and picks out the buyer, the company, the PO reference, remarks and the order lines.
- The workflow finds the customer through the sender's email address, or an email address in the PDF. Without a match it searches companies and contacts by the names in the PO, and the AI picks from at most 20 candidates.
- Each order line is matched on its article number first, as SKU or EAN. Otherwise the workflow searches the catalogue and the AI picks from at most 10 candidates per line. Quantities always come from the PO.
- The workflow creates an order with the PO reference and remarks, sets it to the status in
ORDER_STATUS(defaultDRAFT_ORDER, as in the earlier version) and creates a ticket in the Action Hub. Lines that could not be matched are listed on the ticket, so you can add them yourself. When two lines match the same product, their quantities are added up and the ticket lists both lines, so you can check the quantity.
Every email ends in exactly one ticket. When the workflow cannot create the order, for example because the PDF cannot be read or the customer is not found, the ticket says why and you handle the PO manually.
Install it
- In n8n, import the downloaded JSON as a new workflow.
- Connect your Gmail account on the Gmail Trigger node.
- Connect your OpenAI account on the three AI nodes: Extract Order Data, Match Customer and Match Products.
- Create a header auth credential with your Propeller API key and select it on the eight GraphQL nodes.
- In the Settings node, set
CHANNEL_IDto the channel orders are created in,ASSIGN_TO_ADMIN_USER_IDto the backoffice user who gets the tickets andLANGUAGEto the language of your product names. Optionally setORDER_TYPEtopurchaseorstock. Left empty, Propeller creates a dropshipment order. - Send a test purchase order to the mailbox, run the workflow once manually and check the Action Hub.
- Activate the workflow.
In n8n, create a credential of type Header Auth and fill in its two fields exactly like this:
| Field | What to fill in |
|---|---|
| Name | apiKey |
| Value | Your Propeller API key |
Name is not a title you pick yourself. It has to say exactly apiKey, otherwise the workflow cannot sign in. See Set up n8n for the full steps.
Make it yours
- Which emails: the search filter on the Gmail Trigger node (default
has:attachment filename:pdf). - The AI model: pick another model on the three AI nodes.
- Order type, status and channel:
ORDER_TYPE,ORDER_STATUSandCHANNEL_IDin Settings. - Matching:
COMPANY_CANDIDATESandCANDIDATES_PER_LINEset how many candidates the AI chooses from.
Limits
Only the first PDF of an email is read. A purchase order is read up to 100 lines.
A run that takes longer than one hour is stopped and shows as canceled in the n8n executions list.
Use it outside n8n
Copy the JSON into an AI assistant and follow Adjust a workflow with an AI assistant. The same flow works with any mail provider that your workflow tool supports.
The workflows and agents in the Agent Hub are free to use and adapt. They are examples, not supported product features, so test them in a staging environment and check the results before using them in production.
Related pages
- Voice to quote request - the same idea, starting from a voice memo
- Action Hub