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 and ready to share, with the margin amount.
  • Below 20 percent, it warns you and suggests sending the quote to the sales manager for approval or increasing the margin.

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: change MARGIN_THRESHOLD in the Analyze Margin node. Default is 20 percent.
  • Response wording: edit the approved and warning texts in the same node.

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.