Starbase / 02 RecipeAgents

RecipeAgents / Recipes / Sales

Sales recipe

Gmail → Gmail: Claude quote replies in n8n

A customer emails “can you quote me 40 sheets of plywood and 6 boxes of screws?” and you open a price list, type the same lines again and do the sums. This workflow reads each new quote request in Gmail and saves a draft reply in the same thread, with every line priced from your own Google Sheet and a total. Claude only reads the email and says which item from your list each line means. It never sees a price. A Code node looks the price up, multiplies, adds the total and writes the reply from a fixed template, so the numbers are the ones in your sheet. Anything it cannot price is marked “we are checking this one” and questions about size or delivery are asked in the draft. It never sends: you read the draft and press send. In our study of 13,574 public n8n templates (snapshot 2026-10-20), 41 have quote, quotation or RFQ in their name (quote-of-the-day, stock-quote and quote-video templates left out). 26 (63.4%) have an AI step and 26 (63.4%) use Gmail, but only 13 (31.7%) use Gmail and Google Sheets together, the pair a price list needs. 33 (80.5%) have a Code node. 15 (36.6%) use OpenAI, 8 (19.5%) Gemini and 1 (2.4%) Anthropic, and 1 has an error workflow trigger.

InputA Gmail inbox that receives quote requests, and a Google Sheet price list with the columns item, unit_price and (optional) unit
Toolsn8n (Gmail Trigger, Google Sheets, Code, Gmail), Anthropic API (Claude Haiku 5.5)
TimeSetup about 45 to 60 minutes, most of it making the price list and the Gmail and Sheets sign-ins (our estimate). It saves the five to ten minutes of retyping and adding up a typical multi-line request.
CostClaude Haiku 5.5 costs $0.10 per million input tokens and $0.50 per million output tokens for prompts up to 100,000 tokens (Anthropic pricing, read 2026-11-04). Our arithmetic: a 100-item price list (about 800 tokens of names), a 500-token email and the 300-token prompt make about 1,600 input tokens, and the JSON answer is about 300 output tokens. That is $0.00016 plus $0.00015, so about 3 cents per 100 quote requests. Anthropic notes that newer models produce about 30% more tokens for the same text, so count your own list, but it stays in cents. Google lists the Sheets API read limit at 300 requests a minute per project and 60 a minute per user (usage limits, read 2026-11-04); this workflow makes one read per email. The same page says exceeding the limits is planned to cost money later in 2026, which an ordinary inbox will not reach. On n8n Cloud each email that starts the workflow is one execution.

n8n nodes in this workflow: Google Sheets, Code, Gmail. Each links to usage data and known problems in our n8n node library.

Download it

The n8n file has seven nodes (Gmail Trigger, Google Sheets to read the price list, a Code node that cleans it, Claude to read the request, a Code node that prices and writes the reply, Gmail to save the draft, and Gmail to mark the email read) plus a read-me note. We check that its JSON structure is valid, but we haven't run every file in a live n8n instance, so test it with sample data before you switch it on. All 27 files, the logins each needs and how to fix common import errors are on our n8n templates page. Not sure which tool to run it on? See what this kind of recipe costs in n8n vs Zapier or n8n vs Make. On n8n Cloud the trigger's poll interval matters more than the node count: n8n pricing works through it.

Steps

  1. Make the price list: a Google Sheet with the header row <code>item</code>, <code>unit_price</code>, <code>unit</code> and one product per row. Names must be unique and written the way you would say them to a customer. Up to 300 rows.
  2. Connect credentials in n8n: <b>Gmail</b> (OAuth2; saving a draft needs permission to compose mail), <b>Google Sheets</b> (OAuth2) and <b>Anthropic</b> (an API key from the Claude Console).
  3. Gmail Trigger: our file polls every minute for unread mail in your inbox, not in Promotions, that mentions quote, quotation, estimate, pricing or &ldquo;how much&rdquo;. Change the search to match how your customers write.
  4. Google Sheets &ldquo;Get price list&rdquo;: pick your spreadsheet and sheet. The node is set to give one empty result if the sheet has no rows, so the next step can stop with a clear message.
  5. Code node &ldquo;Collect price list&rdquo;: turns the rows into one clean list and one block of item names. It stops with a message if a name appears twice, a price can't be read, or the list is longer than 300 items.
  6. Anthropic &ldquo;Claude: read the request&rdquo;: model <code>claude-haiku-5-5</code>, the prompt below, 2,000 output tokens. It returns JSON: whether this is a quote request, each line with the quantity and the exact item name from your list (or null), and the questions you would have to ask.
  7. Code node &ldquo;Price and write reply&rdquo;: accepts a name only if it is really in your sheet, multiplies quantity by the sheet price, adds up, and writes the reply from a template. Edit the currency, validity days, VAT note and sign-off at the top of the node. If the email isn't a quote request it stops there and the email stays unread for you.
  8. Gmail &ldquo;Save Gmail draft&rdquo;: creates a plain-text draft in the same thread, addressed to the sender. Then &ldquo;Mark email as read&rdquo; runs last, so an email is only marked once its draft exists.
  9. Send five old quote requests through it (use Execute workflow on each), read the drafts next to your own price list, then activate it. Keep reading every draft before you press send.

The prompt

You read one customer email for a business that sells the items in the price list below. Decide whether it asks for a price or quote, and extract what is asked. Return JSON only, with these keys:
is_quote_request: true or false. False for complaints, invoices, newsletters, thank-you notes, and anything that does not ask for a price.
lines: a list of objects with request (the customer's own words for the item), quantity (a number, or null if the email does not say), and list_item. For list_item copy EXACTLY one name from the price list when it is clearly the same product. Use null if there is no clear match. Never invent a name, and never pick a similar but different product.
questions: a list of short questions you would need answered to price this properly and the email does not say (size, colour, delivery address, date). Empty list if none.
Do not write any prices, totals or discounts. Do not reply to the customer.

Price list (one item name per line):
{{price_list}}

From: {{from}}
Subject: {{subject}}
Email:
{{email}}

Sample run

Example input (written for illustration)
From: Maria Kask &lt;maria@example.com&gt;
Subject: Quote for plywood and screws
Hi, can you quote 40 sheets of 18mm birch plywood and 6 boxes of 4x40 wood screws? Also a pallet of roof tiles. Where do you deliver and how long does it take? Maria

Price list sheet: Birch plywood 18mm sheet 38.50 per sheet; Wood screws 4x40 (box of 200) 6.90 per box.
Invented for illustration.
Example output (shows the format, not a real log)
Draft saved in the same thread:
[CHECK BEFORE SENDING, then delete this line: 1 line(s) have no price yet]

Hi Maria,

Thank you for your request. Here is our quote:

- 40 x Birch plywood 18mm sheet at 38.50 per sheet = 1540.00 EUR
- 6 x Wood screws 4x40 (box of 200) at 6.90 per box = 41.40 EUR
- a pallet of roof tiles: we are checking this one and will confirm the price.

Total for the priced items: 1581.40 EUR
Prices exclude VAT. This quote is valid until 18 November 2026.

To confirm the price, could you tell us:
- What is the delivery address?

Best regards,
YOUR NAME
YOUR BUSINESS
Invented for illustration. We ran the two Code nodes on these values to get the lines and the total; the Claude step was not run on this email.
SPONSOR SLOT · AVAILABLEFeature your product here

Where it breaks

  • The price must never come from the model. Several n8n quote builders discuss the same point. A commenter on a Reddit thread about quoting electronic components (August 2026) says to let the model only extract, keep the arithmetic and the rules in plain code, and keep a human approval step, because a model that does the sums will eventually invent a price. This file works that way: the prompt forbids prices, and the Code node only takes a price from a row whose name exists in your sheet.
  • Claude picks a similar but wrong product. Matching is the hard part, and the model sees only item names. The prompt says null unless the product is clearly the same, and the Code node throws away any name that is not an exact row, so a made-up name becomes “we are checking this one”. A wrong but real name (the 18mm sheet instead of the 12mm one) is still possible, which is why the draft is never sent for you. Check the first 20 drafts line by line, and write list names so that variants differ in the name itself (“Birch plywood 12mm sheet”, not “Birch plywood”).
  • Mark as read matters. The n8n Gmail Trigger’s own node notes (read in the n8n 2.44.4 source, 2026-11-04) say the unread filter changes nothing unless some step marks the email read, and that the marking step belongs after the step that creates the record, so a mid-run failure cannot use up an email without producing its result. That is why “Mark email as read” is the last node. If the draft step fails, the email stays unread for you to see.
  • Line breaks disappear in the draft. The n8n Gmail node’s Email Type defaults to HTML, and plain line breaks collapse in HTML. Our draft node sets Email Type to Text. If you switch to HTML, write the template with <br> or <p> tags.
  • The answer is cut off. The Anthropic node’s Maximum Number of Tokens defaults to 1024 in the n8n 2.44.4 source. A request with 15 or 20 lines can need more than that for the JSON, and a cut-off answer cannot be read. Our file sets 2,000, and the Code node stops with the start of Claude’s answer if it can’t read it.
  • The draft goes to a no-reply address. A web-form or marketplace notification arrives from a no-reply address, with the customer inside the text. The Code node leaves the To field empty for these and puts a CHECK line at the top of the draft. Add the real address by hand. The CHECK line is part of the draft text, so delete it before you send.
  • Prices typed with symbols or decimal commas. Cells like “€12.00” or “12,50” are cleaned by the Collect node (12,50 becomes 12.5, 1,250 becomes 1250). A cell it cannot read as a number is skipped, so check that every product you sell shows up; a product missing from the list is quoted as “we are checking this one”. Two rows with the same name stop the workflow on purpose.
  • Requests in attachments are not read. The workflow reads the email text only. A quote request sent as a PDF or Excel file has no lines to find, so the draft asks the customer to list the items and puts a CHECK line on top. Reading attachments is a separate job (see the PDF summary recipe for how Claude takes a PDF), and the price rule still applies: extract with the model, price in code.
  • Anything customer-facing or money-related. Keep a human approval step until you've watched a few dozen runs and trust it.

Use ChatGPT or Gemini instead, or build it in Zapier

  • ChatGPT or Gemini: replace only the Claude node with the OpenAI or Google Gemini node, paste the same prompt, and ask for JSON output. The “Price and write reply” node reads Claude’s merged_response only, so change its first read line to $input.first().json.message.content for OpenAI or mergedResponse for Gemini (turn on the include-merged-response option in the Gemini node).
  • Zapier: we have not tested this. The steps are in the downloadable blueprint: Gmail search trigger, a Sheets lookup that returns the whole list, the Anthropic step, Code by Zapier for the maths, and Gmail Create Draft. If your lookup step returns only one row, the closed-list matching does not carry over.

Tool names and pricing change often, so check each tool's current docs before you build. Times on this page are estimates, not measurements.

More sales recipes

All collections · Full inbox-triage walkthrough

New to building agents? Plan this one first with the Quote request reply agent spec sheet on PlainAgent, our sister site with plain-English guides. Not sure which AI model to use? See the writing and chat assistant ranking on TaskRank.

Newsletter

One small automation every Friday

Each Friday email has one recipe, the prompt for it, and the way it broke when we wrote it up. It's free, and every email has an unsubscribe link.