Library / AI Agents & Assistants
AI Agents & Assistants
Monitor competitor price shifts with Apify, Postgres, OpenAI, and Slack
On a schedule, it runs an AI agent with OpenAI / ChatGPT using Apify, Postgres, Slack.
What it does
## Run this SQL first The workflow queries pricing.price_history and pricing.price_moves_today. They do not exist until you run this, and the first execution fails with relation "pricing.price_history" does not exist without it. Needs Postgres 15 or later. On Supabase, paste it into the SQL editor and run once. It puts everything in a private schema with RLS on and the anon and authenticated roles revoked, so on Supabase the table is never reachable through the Data API. sql -- Requires Postgres 15 or later, which Supabase satisfies. The views use -- Run once before importing the n8n workflow. create schema if not exists pricing; create table if not exists pricing.price_history ( id bigserial primary key, captured_at timestamptz not null default now(), capture_date date not null default (now()::date), sku_key text not null, -- stable identity you track on; the canonical product URL by default product_url text not null, retailer text, -- hostname, e.g. amazon.com product_name text, brand text, price numeric(12,2), currency text, -- ISO 4217, e.g. USD; the workflow maps symbols before writing in_stock boolean, -- null means the source did not report availability image_url text, raw jsonb -- full Actor output, so you can backfill new columns later ); -- point: no policy means no access. n8n connects as the table owner or as alter table pricing.price_history enable row level security; -- Supabase ships the anon and authenticated roles. Plain Postgres does not, do $$ begin if exists (select 1 from pg_roles where rolname = 'anon') then revoke all on schema pricing from anon, authenticated; revoke all on all tables in schema pricing from anon, authenticated; revoke all on all sequences in schema pricing from anon, authenticated; alter default privileges in schema pricing revoke all on tables from anon, authenticated; end if; end $$; -- One row per SKU per day. Re-running the workflow the same day updates instead of duplicating. create unique index if not exists price_history_sku_day on pricing.price_history (sku_key, capture_date); create index if not exists price_history_sku_time on pricing.price_history (sku_key, captured_at desc); create or replace view pricing.price_baseline with (security_invoker = true) as select sku_key, max(retailer) as retailer, count(*) filter (where capture_date = current_date - interval '30 days') as observations_30d, min(capture_date)
The steps
- Every Morning at 6am
- Select Pages to Monitor
- Run Apify Scraper
- Normalize Product Data
- Save Daily Snapshot to DB
- Detect Price Changes
- Collect Price Changes
- Repricing Analysis Agent
- Chat Model
- Send Slack Alert
- Check Data Integrity
- Send Slack Warning
Similar automations
E-commerce & PaymentsMonitor competitor price gaps with Scrapewise, Google Sheets and Slack6 stepsReports, Analytics & DashboardsDetect competitor SEO strategy shifts with Claude and WhatsApp alerts28 stepsAI Agents & AssistantsTrack macro regime shifts with FRED MCP, OpenAI, and Slack alerts23 stepsAI Agents & AssistantsScore competitor price changes with Apify, Sheets, DeepSeek, ElevenLabs, and Telegram32 steps