Skip to content
AI Agents

Meal Image Nutrition Analysis Webhook with OpenAI

8 nodes 42 2 Webhook
Download

Loading workflow…

Workflow Description

The workflow receives a POST request on a webhook carrying a base64 meal image, sends it to the OpenAI Vision model (chatgpt-4o-latest) with a detailed nutrition-analysis prompt, then re-formats the model output through an LLM chain (gpt-4o-mini) with a manual structured output parser and auto-fixing wrapper, and finally returns the parsed JSON to the calling app via a response node. The workflow is saved inactive and has no authentication on the webhook.

How it works

  1. 1.The meal_image_webhoook node accepts HTTP POST at path fb1795ae-7290-48be-8c52-27b50eb32691 with response deferred to the response node.
  2. 2.The analyze_image node sends the binary property image (base64) to chatgpt-4o-latest with instructions to identify foods, estimate portions, compute nutrition, and return a single JSON object.
  3. 3.The extract_results chain LLM node uses gpt-4o-mini to convert the analysis text into an object matching a manual JSON schema (mealName, calories, macros, sodium, confidenceScore, healthScore).
  4. 4.An Auto-fixing Output Parser wraps the Structured Output Parser to retry corrections when output does not match the schema, reusing gpt-4o-mini.
  5. 5.The respond_to_webhook node returns JSON.stringify($json.output) as the JSON response body.

Use cases

  • Backend service for a calorie-tracking app (e.g., Lovable) that uploads meal photos and receives structured nutrition estimates.
  • On-demand food-photo analysis endpoint for any frontend that POSTs a base64 image named image.

Requirements

  • Valid OpenAI credentials configured for both the analyze_image node and the OpenAI Chat Model node.
  • Incoming requests must include the image as binary data under the property name image.
  • Manual activation of the workflow, since it is saved with active: false.

Setup and testing in n8n

  1. Activate the workflow, POST a food photo to the webhook URL with an image field, and confirm a JSON nutrition payload is returned.
  2. POST a non-food image and verify the response reports confidenceScore 0 and mealName Unidentifiable.
  3. Check execution logs to confirm the structured parser and auto-fixing step succeed on irregular model output.

Service Value

Ideal as a smart automation service combining integrations and AI to produce ready-to-use results.

Apps Used

OpenAI Webhook LLM Chain Output Parser

Details

Trigger Webhook
Nodes 8
Apps 4
Views 42
Downloads 2

How to Use

  1. 1.Click "Download Template"
  2. 2.Open your n8n dashboard
  3. 3.Go to Workflows > Import from File
  4. 4.Select downloaded file and configure credentials

Nodes Used (8)

analyze_image

OpenAI

#1

meal_image_webhoook

Webhook

#2

respond_to_webhook

Webhook

#3

extract_results

LLM Chain

#4

OpenAI Chat Model

OpenAI

#5

Structured Output Parser

Output Parser Structured

#6

Auto-fixing Output Parser

Output Parser Autofixing

#7

Sticky Note

Sticky Note

#8

Source and license

Sticky Note

#9
Stay in the loop

Fresh workflows, straight to your inbox

Get newly published DROPIDEA workflows, a clear overview of what they do, and a link to explore them.

  • New workflows
  • Clear overviews
  • Setup guides

Be first to discover what is new

Your name, your email, and one confirmation.

Email confirmation · Unsubscribe anytime