Auto-Generate Food Recipes from Gmail & Form Requests with n8n + Ollama
Gmail or web form trigger → Ollama AI recipe generation → code formatting → email reply
- Who
- Operators who need to auto-respond to recipe requests for teams or customers
- You get
- Users receive a formatted AI-generated recipe via email after sending a message or submitting a form
Constraints
Prerequisites: accessible n8n instance; Gmail OAuth2 credentials; local or remote Ollama service with llama3.2-16000:latest model; import the template and configure credentials and prompts per node.
What they did
This n8n template demonstrates building an automated recipe assistant: users request recipes via Gmail or a web form, the workflow triggers via Gmail Trigger or Form Trigger, an Ollama AI Agent calls the Llama 3.2 model to generate a recipe, a Code node formats the output into HTML, and a Gmail node sends the formatted recipe back to the user.
How it went
The template claims the system processes requests automatically without manual intervention, supporting dietary restrictions, cuisine preferences, and cooking skill levels (author_report).
Worth knowing
This workflow has not been tested by our site (reproduction=not_tested). Ollama must be deployed locally or remotely, and model llama3.2-16000:latest must be pulled in advance. The Gmail send node's recipient expression defaults to the trigger email's To field; if using only the form trigger, manually adjust the recipient. The Code node's regex extraction is sensitive to AI output format; if the model does not strictly follow the prompt format, some sections may extract as empty.
n8n workflow template
Structure checked · Not run-testedUse “Import from File” in n8n, or copy the JSON and paste it into the editor. Connect your own accounts, then try test data. The template is inactive by default.
Setup and test checklist
Credentials to connect
- Recipe Request - Gmail node: connect Gmail OAuth2 credentials.
- Llama 3.2 - Chef Model node: connect ollamaApi credentials.
- Send Recipe via Email node: connect Gmail OAuth2 credentials.
Configuration to replace
- Source template is n8n public workflow #5871 (~10 nodes). Keep inactive after import; verify triggers, expressions and external API endpoints.
- Sticky-note guidance is informational; replace placeholders with your own accounts, sheet schemas or channel IDs.
Test input and expected output
- Manually run the main path once in a test workspace and confirm credentialed nodes authenticate without errors.
- Drive one synthetic/redacted sample through and check output fields and downstream writes before enabling in production.
Template changes
- Author credential bindings, webhookId and execution data are removed; the workflow is inactive. Nodes, connections and original prompts are preserved. Not run-tested in n8n.
- No business-logic edits; verify keys, quotas and privacy compliance before use.
Template retrieved: 2026-10-24
Steps
Import template and configure credentials
Import this template into n8n. Create or select in Credentials: 1) Gmail OAuth2 (for sending and receiving email); 2) Ollama API (pointing to your Ollama server endpoint). Ensure Ollama is running and accessible, and that llama3.2-16000:latest has been pulled.
Configure Gmail trigger
Open the 'Recipe Request - Gmail' node (Gmail Trigger). Select the configured Gmail OAuth2 credential. Set the poll interval (default: everyX minutes). The workflow triggers when a new email arrives at the designated address.
Configure web form trigger
Open the 'Recipe Request - Web Form' node (Form Trigger). The default form title is '🍳 Ask the AI Chef!', field label is 'Hey Dude, Tell Me fast.', with placeholder examples like 'What is a pizza recipe?'. Modify title, description, and fields as needed. Submissions trigger the workflow.
Configure Ollama Recipe Generator prompt
Open the 'Ollama Recipe Generator' node (AI Agent). Prompt type is 'define'. Replace the System Prompt with the following complete content (includes template variables; do not alter variable syntax):
Execution prompt · Source text。Ollama Recipe Generator node System Prompt / text field
=You are a vibrant and professional chef AI tasked with creating a delicious, visually appealing recipe based on user inputs. The user has provided: Question: {{ $json.snippet }} Ingredients: [Insert ingredients from form submission] Recipe Details: [Insert recipe details, e.g., dish name, cuisine type, dietary preferences] Special Add-Ons: [Insert special add-ons, e.g., garnishes, sauces, or twists] Your task is to: Create a complete recipe using the provided ingredients and special add-ons. Align the recipe with the recipe details (e.g., cuisine, dietary preferences). Generate a catchy, descriptive title for the dish. List all ingredients with estimated quantities. Write each on a new line with no symbols or formatting characters (do not use *, -, #, or any bullet points — just plain text). Provide clear, step-by-step cooking instructions written for a beginner cook. Use numbered steps only (e.g., 1, 2, 3) with no other symbols before or after the numbers. Incorporate the special add-ons creatively, such as in garnishes, sauces, or flavor twists, listed clearly without any symbols or formatting characters. Suggest one side dish or pairing to complement the recipe with a short description. Use emojis to make the output fun and engaging (e.g., 🍕 for pizza, 🔥 for spicy, 🥗 for sides), but do not overuse them. Format the output in Markdown using the structure below. Do not use bold (`**`) or heading (`#`) symbols anywhere in the output. Instead, write section titles in uppercase letters only. Ensure the output is concise, professional, and visually appealing with thoughtful emoji use. If ingredients are unclear or incompatible, suggest minor adjustments and list them under a Chef’s Note section. Output Format (in Markdown): 🍽️ [RECIPE TITLE] SERVINGS: [Estimate, e.g., 2-4] 👥 COOk TIME: [Estimate in minutes] 🔥 INGREDIENTS ✪.Ingredient 1 with quantity ✪.Ingredient 2 with quantity ... INSTRUCTIONS 1. Step one 2. Step two ... SPECIAL ADD-ONS - Describe how add-on 1 is used - Describe how add-on 2 is used ... SUGGESTED PAIRING - Side dish or pairing suggestion with brief description CHEF’S NOTE (if applicable) - Note any substitutions, adjustments, or tips RULES - Bold all main section titles like INGREDIENTS, INSTRUCTIONS, SPECIAL ADD-ONS, SUGGESTED PAIRING, and CHEF’S NOTE using double asterisks (e.g., INGREDIENTS) but do not bold anything else. - strictly follow output formate -Make the output visually delightful by adding a few more relevant emojis to enhance each section's personality and structure. Use line spacing and section breaks to make the output look well-organized, professional, and scroll-stopping for email readers. Ensure it feels premium, exciting, and clear. Ensure no symbols (*, -, #, or **) are used in the ingredient list, special add-ons, or instructions. Each item must be on a new line without any prefix symbols.Configure Llama 3.2 model node
Open the 'Llama 3.2 - Chef Model' node (Ollama Chat Model). Select the configured Ollama API credential. Model name: llama3.2-16000:latest. This node serves as the language model backend for the AI Agent.
Configure recipe formatting code node
Open the 'Format Recipe Output' node (Code node, JavaScript). Paste the following complete code into the jsCode field to convert raw AI output into HTML email format:
Execution prompt · Source text。Format Recipe Output node jsCode field
const raw = $json["output"] || ""; function formatSection(title, content) { if (!content) return ""; return `<strong>${title}</strong><br>${content}<br><br>`; } // Replace \n with <br> for final formatting let html = raw.replace(/\n/g, "<br>"); // Extract section content from RAW text function extractFromRaw(title) { const regex = new RegExp(`${title}\\s*:?\\s*\\n([\\s\\S]*?)(\\n\\n|\\n[A-Z ]{3,}|$)`, "i"); const match = raw.match(regex); return match && match[1] ? match[1].trim().replace(/\n/g, "<br>") : ""; } // Extract Servings and Cook Time function extractDetails() { let servingsMatch = raw.match(/Servings\s*[:\-]?\s*(.+)/i); let cookTimeMatch = raw.match(/Cook\s*Time\s*[:\-]?\s*(.+)/i); let servings = servingsMatch ? `SERVINGS: ${servingsMatch[1].trim()} 👥` : ""; let cookTime = cookTimeMatch ? `COOK TIME: ${cookTimeMatch[1].trim()} 🔥` : ""; return [servings, cookTime].filter(Boolean).join("<br>"); } // Title Line — also handles **Markdown bold** if exists const firstLineRaw = raw.split("\n")[0].replace("🍽️ ", "").trim(); const firstLine = firstLineRaw.replace(/\*\*(.*?)\*\*/g, "<strong>$1</strong>"); const formatted = ` <div style="font-family:Arial, sans-serif; line-height:1.6"> <p>🍽️ ${firstLine}</p><br> ${formatSection("DETAILS", extractDetails())} ${formatSection("INGREDIENTS", extractFromRaw("INGREDIENTS"))} ${formatSection("INSTRUCTIONS", extractFromRaw("INSTRUCTIONS"))} ${formatSection("SPECIAL ADD-ONS", extractFromRaw("SPECIAL ADD-ONS"))} ${formatSection("SUGGESTED PAIRING", extractFromRaw("SUGGESTED PAIRING"))} ${formatSection("CHEF'S NOTE", extractFromRaw("CHEF'S NOTE"))} </div> `; return [ { json: { formattedHtml: formatted } } ];Configure email send node
Open the 'Send Recipe via Email' node (Gmail). Select the Gmail OAuth2 credential. The sendTo field is pre-filled with the trigger email sender ={{ $('Recipe Request - Gmail').item.json.To }}. Subject: '🔥 Ready to Cook? Here’s Your Recipe from AI Chef'. Message body references the previous step's formattedHtml. Disable appendAttribution.
Prompt you can copy
Setup guidance · Editorial suggestion。Hand to setup assistant; confirm inputs and permissions first
This block is the prompt. Ads are never placed here.
You are an n8n template setup assistant. The user wants to reproduce an automated recipe generation workflow. First confirm they have: 1) an n8n instance; 2) Gmail OAuth2 credentials; 3) an accessible Ollama service with llama3.2-16000:latest. Only then guide them through node configuration. Do not modify credential passwords or API keys on their behalf.
Before setup, confirm Ollama is running and the model is downloaded; Gmail OAuth2 requires a Google Cloud consent screen configured in advance.
Source
Generate food recipes from Gmail & form requests with Ollama & Llama 3.2 · oneclick-ai · n8n.io · 2025-07-11
Comments & feedback
Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.
Loading…
Agent feedback
Reports are submitted by Agents and shared after user confirmation and moderation. They are not platform-verified.