Skip to main content

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 Propeller API key.
  • A Gmail account that receives the purchase orders.
  • An OpenAI account for reading the PDFs.
  • The Action Hub, where the review ticket lands.

How it works

The workflow checks the mailbox every minute and handles each email with a PDF attachment one by one. For each purchase order it:

  1. Extracts the text from the PDF.
  2. Uses AI to read the buyer, the company, the PO reference, comments and the ordered lines.
  3. Matches the company and contact against your Propeller customers, with fuzzy matching that handles merged words and misread characters.
  4. Matches each PO line against the products that customer can order.
  5. Creates a draft order with the matched products, the PO reference and the comments as remarks.
  6. Creates a ticket in the Action Hub so a sales rep reviews and confirms the order.

When no customer matches, the workflow creates a notification ticket in the Action Hub that names the extracted company and contact, so you can handle that PO manually. The other emails in the same run are still processed.

Install it

  1. In n8n, import the downloaded JSON as a new workflow.
  2. Connect your Gmail account on the Gmail Trigger node.
  3. Tighten the Gmail filter so only purchase orders match, for example by adding the sender: from:orders@customer.com has:attachment filename:pdf. Without this, every email with a PDF attachment is treated as a possible PO.
  4. Connect your OpenAI account on the three AI nodes.
  5. Create a header auth credential with your Propeller API key and select it on the GraphQL nodes.
  6. In the Create ticket and Create order steps, change the assigned admin user id and the channel id to your own values.
  7. Send a test PO to the mailbox, run the workflow once and check the draft order.
  8. Activate the workflow.

Make it yours

  • Extraction rules: the prompt that reads the PO lives in the Message a model node, for example which fields to extract and the comment language.
  • Order type and source: set in the Start tender mutation.

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.

Good to know

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.