Skip to main content

Margin validator

With one click on a quote, an order or a request, this agent tells a sales rep whether the margin is above your threshold. It is a good first example to install: it needs no API key and no AI. It changes nothing in Propeller.

In short
Where you use itOn a quote, an order or a request in the Sales Hub, behind the Workflows button
StartsWith a click on the agent
Changes in PropellerNothing. The answer is advice and is not stored
Uses AINo
TextsEnglish, Dutch or French: a setting, or the language of the button label that was clicked. You can change them in the settings
Runs in n8nOne per click
DifficultyEasy

What you get​

The AI Agents dialog on a quote with the answer of the margin agent: Approved, with the margin of the quote as a percentage and an amount

The quoteThe answer
Has a margin of 20% or more"Approved", with the margin as a percentage and an amount
Has a lower marginA warning, with the advice to ask the sales manager for approval or to raise the margin
Has lines without a cost price"Margin cannot be confirmed", with the highest margin it can be and the lines without a cost price

The answer names what is open by its status: a quote, a quote request or an order. The settings say which statuses count as a quote and which as a request.

"Approved" is the word of the agent. It does not record an approval and it does not stop a rep from sending the quote.

What you need​

  • An n8n account. See Set up n8n and connect it to Propeller. You do not need an API key for this example.
  • Backoffice access and the Configuration role with Owner access, to register the agent.
  • Cost prices on your products. A line without a cost price counts as costing nothing, which makes the margin look higher than it is.

How it works​

Propeller sends the quote to the workflow when the rep clicks the agent. The workflow adds up the cost price of every line, takes the subtotal minus the discount as revenue and works out the margin as a share of the revenue. All amounts exclude VAT.

Good to know

The workflows and agents in the Agent Hub are free to use and adapt. They are examples, not supported product features. Test them in a test environment and check the results before you use them on real customers.

Install it​

Install a workflow from the library explains each step.

  1. Import the file into n8n.
  2. Follow Register the agent in Propeller with the values below.
  3. Open a quote in the Sales Hub, click Workflows and click the agent.
FieldValue
TriggerButton
Interaction modeSingle turn
PlacementsSales Hub · Quote editor, Sales Hub · Order editor and Sales Hub · Request editor: a quote, an order and a request in the editor

The answer shows in the dialog at once. An error instead of an answer means the address or the login is not right. It can also mean that the workflow is not published.

Make it yours​

SettingDefaultWhat it does
MARGIN_THRESHOLD20The margin, as a percentage, below which the agent warns
LANGUAGE'EN'The language of the answer: 'EN', 'NL' or 'FR'
LABEL_LANGUAGES{}The agent's button label in each language, for example { 'Margin check': 'EN', 'Margecheck': 'NL', 'Contrôle de marge': 'FR' }. A click on the button sends its label as the message. When the message is one of these labels, the answer is in that label's language. With {} the answer is always in LANGUAGE
QUOTE_STATUSESDRAFT_QUOTATION, QUOTATION, COLLABORATION_QUOTEThe statuses the answer calls a quote
REQUEST_STATUSESREQUESTThe statuses the answer calls a quote request. Every other status is called an order
TEXT_OK''Your own heading when the margin is high enough. Empty: "Approved" in the language of the answer
TEXT_LOW''Your own heading when it is not. Empty: "Margin below the threshold"
TEXT_UNKNOWN''Your own heading when lines have no cost price. Empty: "Margin cannot be confirmed"
ADVICE_LOW''Your own advice under a warning. Empty: a sentence about the sales manager

See Fill in order status codes for where to find the codes.

Limits​

  • The check uses one threshold for every quote. It does not know margins per product group or per customer.
  • The agent only sees the quote as it is open on the page.