Back to Alchemy
Alchemy RecipeIntermediateautomation

Automate restaurant menu engineering with sales analysis and cost optimisation

Most restaurant managers spend Tuesday mornings hunched over spreadsheets, cross-referencing last week's sales reports against supplier invoices, trying to figure out which dishes are actually profitable. A steak that sells fifty covers a night might vanish from the menu on Thursday because someone noticed the margins are thinner than expected. Meanwhile, a vegetable side that costs £1.20 to produce and sells for £6 gets overlooked entirely because nobody's tracking it systematically. The result: menus that drift based on gut feel rather than data, pricing that leaves money on the table, and suppliers paid full price for ingredients in dishes customers don't actually want. The good news is that this analysis, recipe costing, and menu optimisation cycle doesn't need to stay manual. You can wire together a workflow that pulls your sales data, matches it against ingredient costs, generates cost-optimised recipes, and even produces menu copy that highlights your best performers. The glue holding this together is straightforward orchestration, and the entire process runs unattended on a schedule you set. Here's what we're building: every Monday morning, your system pulls the previous week's sales figures, analyses them against supplier costs and ingredient pricing, generates optimised recipes using nutrition data, and creates menu descriptions ready for your website or printed materials. Zero manual handoffs between tools.

The Automated Workflow

You'll need four things talking to each other: a data warehouse or notebook to crunch your sales and cost figures, a recipe generator that understands ingredient economics, a copywriting tool to market those dishes, and an orchestration layer to connect them all. For orchestration, n8n is the strongest choice here because it has good support for both webhook responses and scheduled triggers, handles JSON payloads cleanly, and gives you visibility into each step without vendor lock-in.

Step 1: Pull sales data and cost data into a single place

Start by creating a webhook in n8n that accepts your POS (point-of-sale) system data or CSV upload. If you use Toast, Square, or Lightspeed, those systems have APIs you can query directly. Otherwise, export last week's sales as a CSV and configure n8n to receive it via webhook.

POST https://your-n8n-instance.com/webhook/menu-analysis
Content-Type: application/json { "week_ending": "2026-03-15", "sales_data": [ { "dish_name": "Beef Wellington", "quantity_sold": 47, "revenue": 705.00, "cost_of_goods": 282.00 }, { "dish_name": "Mushroom Risotto", "quantity_sold": 23, "revenue": 184.00, "cost_of_goods": 46.00 } ], "supplier_prices": { "beef_trim": 18.50, "puff_pastry": 2.10, "mushrooms_fresh": 0.95 }
}

Next, pass this data to Deepnote via their API. Deepnote acts as your analytical brain; it will consume the JSON payload, calculate margins, identify your profit leaders and laggards, and output a ranked list of dishes worth optimising.

POST https://api.deepnote.com/v1/notebooks/{notebook_id}/run
Authorization: Bearer YOUR_DEEPNOTE_API_KEY
Content-Type: application/json { "parameters": { "sales_json": "{{ $json.sales_data }}", "suppliers_json": "{{ $json.supplier_prices }}" }
}

Inside Deepnote, write a short Python script that calculates profit margins, ranks dishes by contribution, and identifies which ones have the lowest margin-to-popularity ratio. Export the results as JSON.

python
import pandas as pd
import json sales = pd.DataFrame({{ parameters.sales_json }})
sales['margin'] = (sales['revenue'] - sales['cost_of_goods']) / sales['revenue'] * 100
sales['rank'] = sales['margin'].rank(ascending=True) # Identify underperformers: low margin AND high sales volume
underperformers = sales[(sales['margin'] < 30) & (sales['quantity_sold'] > 20)] output_json = json.loads(underperformers.to_json(orient='records'))

Step 2: Generate optimised recipes for underperformers

Once Deepnote has identified which dishes need rework, send that list to Tastebuds AI. Tastebuds has a recipe API that accepts ingredient constraints and cost targets; you can ask it to regenerate a dish with lower-cost substitutes whilst maintaining nutrition and flavour profiles.

POST https://api.tastebuds.ai/v2/recipes/optimise
Authorization: Bearer YOUR_TASTEBUDS_KEY
Content-Type: application/json { "original_dish": "Beef Wellington", "current_cost_per_serve": 6.00, "target_cost_per_serve": 4.50, "constraints": { "cuisine": "British", "dietary": ["gluten-free-option"], "protein_source": "beef" }, "supplier_inventory": {{ $json.supplier_prices }}
}

Tastebuds returns a JSON object with ingredient lists, preparation notes, nutritional breakdown, and updated cost. Store this output temporarily in n8n's memory.

Step 3: Generate menu descriptions and marketing copy

Take the optimised recipes and pass them to Copy.ai. Copy.ai has a structured content API that accepts recipe data and outputs polished menu descriptions, social media captions, and email copy promoting the new versions.

POST https://api.copy.ai/v1/generate
Authorization: Bearer YOUR_COPYAI_KEY
Content-Type: application/json { "template": "menu_description", "dish_data": { "name": "Beef Wellington", "original_description": "Tender beef tenderloin wrapped in mushroom duxelles and golden puff pastry", "new_ingredients": "Beef chuck roast, button mushrooms, shallots, thyme, beef stock", "nutrition": { "calories": 480, "protein": 42, "fat": 24 } }, "tone": "upmarket-casual", "length": "short"
}

Copy.ai delivers polished copy ready to drop into your menu system or website.

Step 4: Send everything to storage and create a summary report

Finally, have n8n collect the results, aggregate them into a single JSON object, and save to Google Drive, Airtable, or your own database. Then, send yourself (and your head chef) a Slack message or email summarising the week's findings, which dishes changed, and what the new margins look like.

json
{ "report_date": "2026-03-15", "dishes_analysed": 12, "dishes_optimised": 3, "potential_margin_improvement": "£247 per week", "optimised_dishes": [ { "dish_name": "Beef Wellington", "old_margin": 60, "new_margin": 40, "old_cost": 6.00, "new_cost": 4.50, "new_menu_description": "Succulent beef chuck roast, layers of wild mushroom and herb paste, wrapped in crisp pastry. Served with red wine jus." } ]
}

Configure n8n to run this entire workflow every Monday at 7 a.m. using a Cron trigger. No manual work beyond that initial setup.

The Manual Alternative

If you prefer hands-on control over each step, you can run Deepnote notebooks manually and review the recommendations before sending recipes to Tastebuds. This adds a day or two to the cycle but gives you a chance to reject suggestions that don't fit your restaurant's identity or sourcing preferences. Copy.ai output should always be reviewed by someone who knows your brand voice; AI-generated menu descriptions can sometimes miss the mark on tone. Use the workflow as a starting point, not gospel.

Pro Tips

Monitor API rate limits early.

Tastebuds AI allows 100 requests per day on their standard tier.

If you have a large menu and run this weekly, you're fine. If you trial daily runs, you'll hit the ceiling. Check quota usage in your n8n logs and adjust your trigger schedule accordingly.

Build in error handling for missing supplier data.

If your POS system doesn't export cost figures for a particular ingredient, Deepnote's calculation will fail. Add a fallback in your n8n workflow that uses historical average costs or flags the gap for manual input. Don't let the automation grind to a halt because one field is missing. Validate Tastebuds recipes with your head chef before publishing. The API can suggest ingredient swaps that are technically valid but might change the dish's character. A two-minute review step prevents recipes that technically work but don't taste right.

Use Copy.ai's tone parameter to match your brand.

If you run a fine-dining establishment, set the tone to "refined" or "sophisticated". If you're casual, use "approachable" or "fun". Mismatched tone undermines the whole effort.

Track margin improvements week-to-week in Deepnote.

Once you've implemented optimisations, store the new cost baseline so next week's analysis shows actual change, not just potential improvement.

Cost Breakdown

ToolPlan NeededMonthly CostNotes
n8nSelf-hosted or Cloud Pro£0–£39Self-hosted is free; Cloud Pro adds team features and uptime guarantee
DeepnoteFree or Standard£0–£25Free tier includes 100 compute hours monthly; enough for weekly analysis
Tastebuds AIStarter£29100 requests per month, includes USDA nutrition data
Copy.aiTeam£49Unlimited API calls after monthly limit; includes template library
Total£107–£145Self-hosted n8n keeps costs low; Cloud pricing adds ~£39