Skip to main content

Ingredient price trend analysis & buying recommendations with PostgreSQL, API & Slack

Workflow preview

Workflow preview
100%
Ingredient price trend analysis & buying recommendations with PostgreSQL, API & Slack preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

This automated n8n workflow monitors ingredient price changes from external APIs or manual sources, analyzes historical trends, and provides smart buying recommendations. The system tracks price fl...

Best for

  • Market Research automation workflows
  • AI Summarization automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.cron, n8n-nodes-base.httprequest, n8n-nodes-base.postgres, n8n-nodes-base.code, n8n-nodes-base.emailsend, n8n-nodes-base.stickynote

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Oneclick AI Squad.

Original n8n.io source

1.1 Workflow description

Title
Ingredient price trend analysis & buying recommendations with PostgreSQL, API & Slack
Workflow name
Ingredient price trend analysis & buying recommendations with PostgreSQL, API & Slack

This automated n8n workflow monitors ingredient price changes from external APIs or manual sources, analyzes historical trends, and provides smart buying recommendations. The system tracks price fluctuations in a PostgreSQL database, generates actionable insights, and sends alerts via email and Slack to help restaurants optimize their purchasing decisions.

What is Price Trend Analysis?

Price trend analysis uses historical price data to identify patterns and predict optimal buying opportunities. The system analyzes price movements over time and generates recommendations on when to buy ingredients based on current trends and historical patterns.

Good to Know

  • Price data accuracy depends on the reliability of external API sources
  • Historical data improves recommendation accuracy over time (recommended minimum 30 days)
  • PostgreSQL database provides robust data storage and complex trend analysis capabilities
  • Real-time alerts help capture optimal buying opportunities
  • Dashboard provides visual insights into price trends and recommendations

How It Works

  1. Daily Price Check - Triggers the workflow daily to monitor price changes
  2. Fetch API Prices - Retrieves the latest prices from an external ingredient pricing API
  3. Setup Database - Ensures database tables are ready before inserting new data
  4. Store Price Data - Saves current prices to the PostgreSQL database for tracking
  5. Calculate Trends - Analyzes historical prices to detect patterns and price movements
  6. Generate Recommendations - Suggests actions based on price trends (buy/wait/stock up)
  7. Store Recommendations - Saves recommendations for future reporting
  8. Get Dashboard Data - Gathers necessary data for dashboard generation
  9. Generate Dashboard HTML - Builds an HTML dashboard to visualize insights
  10. Send Email Report - Emails the dashboard report to stakeholders
  11. Send Slack Alert - Sends key alerts or recommendations to Slack channels

Database Structure

The workflow uses PostgreSQL with two main tables:

  1. price_history - Historical price tracking with columns:

    • id (Primary Key)
    • ingredient (VARCHAR 100) - Name of the ingredient
    • price (DECIMAL 10,2) - Current price value
    • unit (VARCHAR 50) - Unit of measurement (kg, lbs, etc.)
    • supplier (VARCHAR 100) - Source supplier name
    • timestamp (TIMESTAMP) - When the price was recorded
    • created_at (TIMESTAMP) - Record creation time
  2. buying_recommendations - AI-generated buying suggestions with columns:

    • id (Primary Key)
    • ingredient (VARCHAR 100) - Ingredient name
    • current_price (DECIMAL 10,2) - Latest price
    • price_change_percent (DECIMAL 5,2) - Percentage change from previous price
    • trend (VARCHAR 20) - Price trend direction (INCREASING/DECREASING/STABLE)
    • recommendation (VARCHAR 50) - Buying action (BUY_NOW/WAIT/STOCK_UP)
    • urgency (VARCHAR 20) - Urgency level (HIGH/MEDIUM/LOW)
    • reason (TEXT) - Explanation for the recommendation
    • generated_at (TIMESTAMP) - When recommendation was created

Price Trend Analysis

The system analyzes historical price data over the last 30 days to calculate percentage changes, identify trends (INCREASING/DECREASING/STABLE), and generate actionable buying recommendations based on price patterns and movement history.

How to Use

  • Import the workflow into n8n
  • Configure PostgreSQL database connection credentials
  • Set up external ingredient pricing API access
  • Configure email credentials for dashboard reports
  • Set up Slack webhook or bot credentials for alerts
  • Run the Setup Database node to create required tables and indexes
  • Test with sample ingredient data to verify price tracking and recommendations
  • Adjust trend analysis parameters based on your purchasing patterns
  • Monitor recommendations and refine thresholds based on actual buying decisions

Requirements

  1. PostgreSQL database access
  2. External ingredient pricing API credentials
  3. Email service credentials (Gmail, SMTP, etc.)
  4. Slack webhook URL or bot credentials
  5. Historical price data for initial trend analysis

Customizing This Workflow

Modify the Calculate Trends node to adjust the analysis period (currently 30 days) or add seasonal adjustments. Customize the recommendation logic to match your restaurant's buying patterns, budget constraints, or supplier agreements. Add additional data sources like weather forecasts or market reports for more sophisticated predictions.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Daily Price Check

Type / Role
n8n-nodes-base.cron - cron
Config choices
Version 1

Block 2 - Fetch API Prices

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.1

Block 3 - Store Price Data

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.4

Block 4 - Calculate Trends

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.4

Block 5 - Generate Recommendations

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 6 - Store Recommendations

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.4

Block 7 - Get Dashboard Data

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.4

Block 8 - Generate Dashboard HTML

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 9 - Send Email Report

Type / Role
n8n-nodes-base.emailSend - emailSend
Config choices
Version 2.1

Block 10 - Send Slack Alert

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.1

Block 11 - Setup Database

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.4

Block 12 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Ingredient price trend analysis & buying recommendations with PostgreSQL, API & Slack
Complexity intermediate
Nodes 12
Categories Market Research, AI Summarization
Author Oneclick AI Squad
Published 14 Jul 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/5987/5987.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Ingredient price trend analysis & buying recommendations with PostgreSQL, API & Slack do?

This automated n8n workflow monitors ingredient price changes from external APIs or manual sources, analyzes historical trends, and provides smart buying recommendations. The system tracks price fl...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Market Research, AI Summarization use case.