Quick overview
This consists 3 different workflows. Each one should be saved into individual workflows.
The goal of these workflows is to automate a tedious process of creating a monthly merchant and industry review deck a task that might take a risk team 20+ hours to build
How it works
- Runs on a monthly schedule and initializes the run metadata (month, execution ID, timestamp).
- Retrieves active merchants and MCC reference data from Supabase, groups merchants by MCC, and uses Perplexity plus Claude to generate an MCC risk snapshot with key flags and a recommended action.
- Writes each MCC snapshot back to Supabase and aggregates all MCC snapshots for the run.
- Pulls high-risk merchants for the current month from Supabase and gathers external signals by screening names with OpenSanctions, searching recent cases in CourtListener, fetching recent Google reviews via Apify, and collecting adverse media via Tavily.
- Scrapes each merchant website with Firecrawl and uses Claude to classify the business vertical and flag restricted content.
- Uses Claude with Pinecone retrieval of prior Risk Committee decisions (embedded with OpenAI) to produce a single recommended action per merchant and inserts those recommendations into Supabase.
- Calculates 12-month portfolio trends from Supabase metrics, generates a short portfolio narrative with Claude, saves it to Supabase, and records a monthly manifest summarizing the run.
- Exposes a webhook that fetches the stored Supabase data for a requested month, formats it for downstream slide-building, and returns the JSON response.
Setup
- Create and connect credentials for Supabase, Anthropic (Claude), Perplexity, OpenAI (embeddings), Pinecone, Apify, Tavily, Firecrawl, and the two HTTP header auth credentials used for OpenSanctions and CourtListener.
- In Supabase, create/confirm the required tables and fields referenced by the workflow (merchants, mcc_codes, monthly_metrics, mcc_risk_snapshots, recommended_actions, portfolio_snapshots, monthly_manifest).
- Populate the Pinecone index name (n8nrisk) and run the manual ingestion workflow to embed and insert the provided prior decision examples before enabling the monthly recommendation step.
- Update any environment-specific constants such as the webhook path usage in your slide-building tool and verify the Supabase filters match your month format (yyyy-MM) and risk thresholds.
- If using the webhook integration, copy the production webhook URL and configure it in your external deck builder (for example, Claude “cowork”) to request the month parameter as needed.
Additional info
This template runs a monthly risk review that pulls merchant and MCC data from Supabase, researches industry changes with Perplexity, screens high-risk merchants using OpenSanctions, CourtListener, Apify, Tavily, and Firecrawl, and uses Anthropic Claude plus Pinecone to store risk snapshots and recommendations.
YouTube Video: https://www.youtube.com/watch?v=u8-bQlMtAKE&feature=youtu.be
Free Skool AI/n8n Group: https://www.skool.com/data-and-ai
LinkedIn: https://www.linkedin.com/in/ryan-p-nolan/
Twitter/X:https://x.com/RyanMattDS
Website: https://ryanandmattdatascience.com/