Arsal MuradAI and automation engineer

← All three n8n templates

Email replies drafted with Groq and checked in code before they send

A webhook receives a message, n8n's Guardrails node strips card numbers, IBANs and API keys, Groq drafts a reply from facts you approve, and code checks it. The recipient is set in code, never by the model.

n8n template 19936 · 18 working nodes, 8 sticky notes · verified creator

Template 19936

What it does

An AI assistant that reads email will follow instructions hidden inside it, because the model cannot tell your rules apart from text in the message. This workflow limits what the assistant can do, in code, instead of trusting it to resist.

Who it is for

Teams letting an AI draft replies to customer email, helpdesk tickets or form messages, who need to be sure it can never send data to the wrong place.

The flow

  1. A webhook receives a message and normalises it into sender, subject, body and message ID.
  2. The workflow rebuilds the visible text a person would read, detects hidden or encoded instruction-like content, and scores the risk.
  3. The n8n Guardrails node replaces card numbers, IBANs, national ID numbers and API keys with placeholders, so the model never sees them.
  4. High-risk messages are blocked before they reach the model and marked for review, with the reasons.
  5. The cleaned message and your approved business facts go to Groq, which returns a draft reply as JSON. The model writes the wording only and never chooses the recipient.
  6. Code checks the draft for length, unapproved links, stray email addresses and card or key shaped text. Approved replies go to your sending endpoint, addressed to the original sender. Anything else is held with the reason, and one report covers the run.

Credentials it needs

  • Groq API: an API key credential on the POST Writing to LLM node. Any OpenAI-compatible API can replace it.
  • A sending endpoint, or a Gmail, Microsoft Outlook or Slack node in place of POST Final Reply.

The hard part

The template was built and tested against live runs, and three behaviours came out of that testing.

The reply is checked as well as the input. When its facts contained an outside link, an outside address and a card-shaped number and it was told to quote them, the model did, and the code blocked all three.

Every message is accounted for. The Guardrails node was seen returning fewer items than it received, so a code step matches the results back by item link and marks anything the sanitiser skipped.

Failures hold instead of send: model unavailable, malformed JSON, skipped redaction, or an error from the sending step.

Good to know. It starts in dry run (dry_run is true), so the first run sends nothing.

The n8n creator page for Muhammad Arsal Murad listing three workflow templates, with the verified badge
My creator page on n8n.io, three templates.

Explore the workflow

The n8n template page for draft safe email replies from webhooks with Groq and n8n Guardrails, created by Muhammad Arsal Murad, verified
Download workflow JSONOpen on n8n.io

The live view is n8n's own preview. It loads only when you press the button, and your browser then sends this workflow to n8n's servers.

Book 20 minutes