If you use AI to read client replies, the clear yes and the clear no are easy. The reply that causes trouble is the mixed one: “Looks good, but can you change the logo?” A lot of classifiers call that approved. The task moves to done and the logo change gets lost.
Two checks fix most of this, and you can add them to any workflow:
- Ask the model for the exact sentence it based its decision on, not only a label, and ask it to say whether the approval has any conditions.
- In a Code node, confirm that sentence really appears in the email. Accept an approval only when the quote is found and there are no conditions. Everything else goes to a person.
A minimal version of the quote check (Code node, Run Once for Each Item). Change emailText and quote to your own field names:
const clean = (t) => (t || '').toLowerCase().replace(/\s+/g, ' ').trim();
const email = clean($json.emailText);
const quote = clean($json.quote);
return { json: { ...$json, quoteFound: quote.length > 0 && email.includes(quote) } };
My full version does this for ClickUp: it emails the client when a task reaches review, reads the reply, moves the task to approved or revisions, and turns requested changes into a checklist. You can find it in the n8n template library under my name.
Would your workflow count “Looks good, but can you change the logo?” as approved, send it to a person, or have you never tested it? And what is the most confusing reply a client has sent you to a review request? Leave the names out and post it here.
1 Like
One thing worth adding to the quote check: strip the quoted history from the reply before you run it. Most clients reply on top of your original review email, so emailText often still contains your own message underneath (“Please reply with approved or tell us what to change”). The model can then quote a sentence that came from you, and the includes() check passes because that sentence really is in the email.
Cutting the body at the first “On … wrote:” line or the first line starting with “>” before both the AI step and the Code node fixes most of it. Outlook replies use a “From:” / “Sent:” block instead, so it’s worth checking for that too.
The other reply that trips classifiers here is the short one with a late addition: “Approved!” in the first line, then “oh and the date on page 2 is wrong” three lines later. Asking for conditions like you do catches it, as long as the model sees the whole reply and not just a preview snippet.
Yes, you are right, the snippet in the post does not do that. I kept it short for the post, but anyone copying it should cut the quoted part first.
The template itself cuts the old emails and my own review email before anything reads the reply. And for the “Approved! oh and the date on page 2 is wrong” kind of reply, it does not just trust Claude. If Claude says approved but also lists a change, it comes to me to check.
Have you dealt with clients who answer inline, inside the quoted email? That one still bothers me, because cutting at the first quoted line would lose half their answer.
Inline replies are the one case where I’d stop trying to cut the quote and instead compare against what you sent. You already have your review email (it’s in the workflow that sent it, or in the Sent folder by thread ID), so you can strip your lines rather than guessing where the quote starts:
// Code node: keep only lines the client actually wrote
const norm = s => s.replace(/^[>\s]+/, '').replace(/\s+/g, ' ').trim().toLowerCase();
const sent = new Set($('Get sent review email').first().json.text.split('\n').map(norm).filter(Boolean));
const lines = $json.text.split('\n');
const own = lines.filter(l => {
const n = norm(l);
if (!n) return false;
if (/^(on .+ wrote:|from:|sent:|to:|subject:)/i.test(l.trim())) return false;
return !sent.has(n); // drop anything that was in our email, quoted or not
});
// inline = the client typed something *after* the first quoted line
const firstQuote = lines.findIndex(l => l.trim().startsWith('>'));
const inline = firstQuote > -1 && lines.slice(firstQuote).some(l => {
const n = norm(l);
return n && !l.trim().startsWith('>') && !sent.has(n) && !/^(on .+ wrote:)/i.test(l.trim());
});
return [{ json: { clientText: own.join('\n'), inline } }];
Two notes on using it:
- Run the AI step and the quote check on
clientText, not the raw body. A quote the model returns then has to come from the client’s own lines, so it can’t pick up your “reply with approved” sentence.
- If
inline is true, don’t auto-approve at all. Pass the classifier the client’s lines with the nearest line of your email above each one as context (so “fine” under “Logo: blue version” means something), but send the result to a person. Inline answers are almost always a point-by-point review, which is exactly the mixed case you don’t want decided automatically.
Gmail HTML is easier than plain text if you have it: quoted parts sit inside div.gmail_quote / blockquote, and inline answers show up as text between those blocks. Outlook usually doesn’t mark them at all, so the “compare with what you sent” step is the part that covers both.
Comparing against what I sent makes more sense than guessing where the quote starts, especially with Outlook, where the old email often is not marked at all.
My template already removes any copy of my own email from the reply, but I had not thought about flagging inline answers. Your “fine” under “Logo: blue version” example is the same mixed reply this post is about, just spread across the email instead of sitting in one sentence. A client can approve the logo and ask for a different photo two lines further down, and a classifier reading the whole thing could easily call that approved.
So inline replies will go straight to a person, with each of the client’s lines shown under the line of mine it answers. That way whoever reviews it does not have to piece the email back together.
How do you handle a client who replies with just “ok” or a thumbs up from their phone? There is barely anything of theirs left to quote.
I would keep a third status for this instead of forcing every reply into approved or not. A message that compliments the work and also asks for a change should stay open as changes requested, and the requested change should be written into a comment or checklist item so it is not lost once a label is saved.
A simple gate before the model helps: if the text contains words like but, however, except, or can you, skip auto-approval and send it to a person, even when the first sentence sounds positive. Clear one-word approvals can still go through on the fast path.
A bare “ok” is only ambiguous if you look at it on its own. Judge it against the email it answers, and it’s usually easy:
- Check it answers the latest request. Read the reply’s
In-Reply-To header and compare it with the message ID of the most recent review email you sent for that job. An “ok” that answers revision 1 while revision 2 is already out shouldn’t approve revision 2. That case goes to a person.
- Count what you asked. If that email asked one yes/no question about one version, a bare “ok” or
is a yes to exactly that version, so store the version or file ID with the approval, not just “approved”. If your email listed several items (“logo, photo, headline”), “ok” can’t tell you which ones it covers. Send it to a person, or auto-reply “Just to confirm, all three as shown?” and wait for that answer.
- Strip phone signatures first, or “ok” never looks short:
Sent from my iPhone, Get Outlook for iOS/Android, Sent from Yahoo Mail, and the like.
A small gate before the classifier:
// Code node: decide short replies by rule, everything else goes on to the classifier
const sigs = /^(sent from my \w+|get outlook for (ios|android)|sent from yahoo mail.*)$/i;
const text = $json.clientText.split('\n').filter(l => !sigs.test(l.trim())).join(' ').trim();
const isBareYes = /^(ok(ay)?|k|yes|yep|sure|fine|good|approved|perfect|👍|✅)[.! ]*$/i.test(text);
const latestId = $('Get latest review email').first().json.messageId;
const answersLatest = $json.headers['in-reply-to'] === latestId;
const itemsAsked = $('Get latest review email').first().json.itemsAsked; // 1 if single question
if (isBareYes && answersLatest && itemsAsked === 1) return [{ json: { route: 'approved', version: $json.version } }];
if (isBareYes) return [{ json: { route: 'person', reason: answersLatest ? 'ok covers several items' : 'ok answers an older version' } }];
return [{ json: { route: 'classifier', text } }];
On the thumbs up: a Gmail emoji reaction isn’t a normal reply. It arrives as a message with a MIME part of type text/vnd.google.email-reaction+json (body like {"emoji":"👍","version":1}), and the plain-text part is just a fallback line. If you fetch the message with the Gmail API (format=full) you can look for that mimeType in payload.parts and treat it like a bare “ok” through the same rules above. I haven’t checked how every other client delivers reactions, so anything that isn’t plain text or that known type should go to a person.
The itemsAsked count is easiest to set when you send the review email (one row per item in the sheet), so you aren’t guessing it from the text later.