Content: 02152.zip (44.75 KB)
Uploaded: 15.01.2026

Positive responses: 0
Negative responses: 0

Sold: 0
Refunds: 0

$7
# Get valid nutritional data in JSON from AI via webhook with retries on errors

This workflow solves the problem of reliably extracting structured data from LLM responses without risking parsing failures. Instead of relying on unstable built-in parsers, it uses manual JSON schema validation with up to three retry attempts when formatting errors occur.

## Who it´s for
- Developers building AI assistants that require reliable structured output
- Product teams integrating AI into data processing systems
- Analysts needing precise JSON responses from LLMs without parsing errors
- Automators working around unreliable native parsers in n8n

## What the automation does
- Receives a text query (e.g., "avocado") via HTTP webhook
- Sends the query to a LangChain agent powered by OpenAI to generate nutritional data
- Validates the response against a predefined JSON schema (keys, types, value ranges)
- On invalid format — sends a corrective prompt and retries up to 3 times
- On valid JSON or exhausted retries — forwards the result as a clean structured object
- Handles invalid inputs (e.g., "not a food") with a predefined error code

## What´s included
- Ready-to-use n8n workflow with LangChain agent logic
- Preconfigured triggers (webhook, message)
- Integrations with OpenAI API and HTTP webhook endpoint
- Manual JSON schema validation and retry mechanism
- Basic text instructions for launch and adaptation

## Requirements for setup
- n8n account (cloud or self-hosted)
- OpenAI API key
- Webhook management access (to receive external requests)

## Benefits and outcomes
- Eliminates workflow failures due to LLM response parsing issues
- Ensures all outputs strictly comply with the defined JSON schema
- Reduces downstream system load by providing clean, validated data
- Retry logic prevents failure on temporary formatting errors
- Can be used in chatbots, CRMs, or data logging systems without extra processing

## Important: template only
Important: you are purchasing a ready-made automation workflow template only. Rollout into your infrastructure, connecting specific accounts and services, 1:1 setup help, custom adjustments for non-standard stacks and any consulting support are provided as a separate paid service at an individual rate. To discuss custom work or 1:1 help, contact via chat
No feedback yet