Skip to main content

Margin validator

Checks the margin of the quote you are working on and tells you whether it is ready to share. Sales reps get an instant answer from a button on the quote editor instead of calculating margins by hand.

Runs: Embedded in Propeller · Trigger: Button · Difficulty: Easy

What you need​

  • An n8n account. See Set up n8n.
  • Owner access on the Configuration role to create the agent.

How it works​

When you click the button on the quote editor, Propeller sends the quote to the workflow. The workflow sums the cost prices of all lines (including child items), calculates the revenue as the subtotal minus the discount and computes the margin percentage.

  • At 20 percent or higher, it replies that the quote is approved, with the margin.
  • Below 20 percent, it warns you and suggests sending the quote to the sales manager for approval or raising the margin.

A line without a cost price counts as zero cost, which makes the margin look higher than it is. When a quote has such lines, the agent does not approve it: it shows the margin as an upper bound and names those lines.

Install it​

  1. In n8n, import the downloaded JSON as a new workflow.
  2. On the Webhook node, set a basic auth credential (a username and password you choose) and copy the production URL.
  3. Activate the workflow.
  4. Go to Admin > Agents and create an agent with Trigger Button and Interaction Mode Single Turn. Under Types, pick SALES_HUB_QUOTE_EDITOR, SALES_HUB_ORDER_EDITOR and SALES_HUB_QUOTE_REQUEST_EDITOR. Paste the webhook URL and the same basic auth username and password. See AI Agents.
  5. Open a quote, click the Workflows button and run the agent to test it.
Placement matters

An agent type is the page where the agent appears. Stick to the types listed in the install steps: the workflow depends on the data that page sends along, so placing the agent on other pages may not work.

Make it yours​

  • Threshold and texts: MARGIN_THRESHOLD, TEXT_OK, TEXT_LOW, TEXT_UNKNOWN and ADVICE_LOW in the Settings node. Default threshold is 20 percent.

Limits​

The workflow makes no API calls. It uses only the quote Propeller sends, so the answer is instant for any quote size.

Use it outside n8n​

Copy the JSON into an AI assistant and follow Adjust a workflow with an AI assistant.

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.