Quick Overview
This workflow logs daily gold prices in INR from MetalpriceAPI into an n8n Data Table, calculates day-over-day changes, and uses Google Gemini to send Slack alerts for ±1% moves and a weekly trend report.
How it works
- Runs every morning at 10:00 to fetch the latest XAU price in INR from MetalpriceAPI.
- Converts the returned rate into a per-10g gold price and stores it as a new row in an n8n Data Table.
- Retrieves all saved prices, takes the last two entries, calculates absolute and percentage change, and updates the latest row with these metrics.
- If the percentage change is ≥ 1% or ≤ -1%, Google Gemini drafts a short alert message and posts it to a Slack channel.
- Runs weekly at 10:00, fetches all Data Table records, and keeps the most recent seven entries.
- Aggregates the last seven days of prices and changes, Google Gemini generates a formatted summary report, posts it to Slack, and saves the report text back to the latest Data Table row.
Setup
- Add your MetalpriceAPI credentials (HTTP header auth) and confirm the request parameters (base=INR, currencies=XAU) match your needs.
- Create or select an n8n Data Table with columns for gold_prices, price_change, percent_change, and alert_message, and update the workflow’s Data Table ID to point to it.
- Add Google Gemini (PaLM) API credentials for the alert and reporting prompts.
- Add Slack credentials and set the target channel for both Slack posting steps.
- Review the schedule triggers (daily and weekly at 10:00) and adjust the timezone/time as needed.