⚡ iMessage food photo nutritional analysis with GPT-4 Vision & Memory Storage

2,073 views · ⚡ Personal Productivity

Description

iMessage AI-Powered Smart Calorie Tracker

> 📌 What it looks like in use:
Sticky Note
> This image shows a visual of the workflow in action. Use it for reference when replicating or customizing the template.

This n8n template transforms a user-submitted food photo into a detailed, friendly, AI-generated nutritional report — sent back seamlessly as a chat message. It combines OpenAI’s visual reasoning, Postgres-based memory, and real-time messaging with Blooio to create a hands-free calorie and nutrition tracker.


🧠 Use Cases


📌 Good to Know


⚙️ How It Works

  1. Webhook Trigger
    The workflow begins when a message is received via Blooio. This webhook listens for user-submitted content, including any image attachments.

  2. Image Validation and Extraction
    A conditional check verifies the presence of attachments. If images are found, their URLs are extracted using a Code node and prepared for processing.

  3. Image Analysis via AI Agent
    Images are passed to an OpenAI-based agent using a custom system prompt that:

    • Identifies the meal,
    • Estimates portion sizes,
    • Calculates calories, macros, fiber, sugar, and sodium,
    • Scores the meal with a health and confidence rating,
    • Responds in a chatty, human-like summary format.
  4. Memory Integration
    A Postgres memory node stores user interactions for recall and contextual continuity, allowing day/week/month reports to be generated based on cumulative messages.

  5. Response Aggregation & Summary
    Messages are aggregated and summarized by a second AI agent into a single concise message to be sent back to the user via Blooio.

  6. Message Dispatch
    The final message is posted back to the originating conversation using the Blooio Send Message API.


🚀 How to Use


✅ Requirements


🛠️ Customising This Workflow

🔗 Nodes Used

HTTP Request, Webhook, AI Agent, OpenAI Chat Model, Postgres Chat Memory

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup