Quick overview
This workflow runs hourly to read Stripe transaction logs from Google Sheets, normalize and load them into Supabase, then uses Groq (OpenAI-compatible chat completions) to detect anomalies and, when found, records incidents in Supabase and posts an alert to Slack while logging errors back to Google Sheets.
How it works
- Runs every hour on a schedule.
- Reads raw Stripe-like transaction rows from a Google Sheets worksheet and normalizes fields (for example converting cents to USD and parsing risk scores).
- Inserts the cleaned transactions into a Supabase table for analytics.
- Sends the inserted transaction data to Groq’s chat completions API with a prompt to return an anomaly result as strict JSON.
- Parses the Groq response into structured fields and checks whether an anomaly is flagged.
- If an anomaly is true, writes an incident record to a Supabase incident_logs table and posts an alert message to a Slack channel.
- If Supabase, Groq, or Slack steps error, appends an error entry (including node name, severity, and transaction_id) to an error_logs sheet in Google Sheets.
Setup
- Connect Google Sheets OAuth2 credentials and set the spreadsheet and worksheet IDs for the raw input sheet and the error_logs sheet.
- Connect Supabase credentials and ensure the analytics_data and incident_logs tables exist with columns matching the fields used (for example transaction_id, amount, risk_score, anomaly_type, severity, ai_label, and record_id).
- Add your Groq API key (or replace the Authorization header) and confirm the model name and endpoint URL are correct for your Groq account.
- Connect Slack OAuth2 credentials and select the target channel for anomaly alerts.