Generate incident response reports with Supabase, Gemini and Claude

Go to Workflow
1 views
Built by Viraj Viraj
Created on June 17, 2026

Description

Quick Overview
This workflow ingests incident and playbook content from GitHub into Supabase (including pgvector embeddings with Google Gemini) and, on a webhook trigger, enriches a test incident with historical matches, a routed response playbook, and live web threat intel (via Tavily + OpenRouter) to generate a validated incident response report.

How it works
Receives a POST webhook containing the incident payload (including an encrypted OpenRouter API key) and decrypts the key for downstream LLM calls.
Creates a tracking row in a Supabase table and loads configuration values used by the retrieval and report-generation steps.
Retrieves similar resolved incidents from a Supabase pgvector store using Google Gemini embeddings and returns structured historical patterns.
Retrieves the best-matching reference playbook from a Supabase pgvector store and fetches the full playbook text from Supabase, falling back to a built-in generic playbook when no match is found.
Uses Tavily Search plus an OpenRouter-backed agent to gather external threat intelligence, IOCs, and phased mitigation guidance when the incident is classified as security-relevant.
Merges the three intelligence branches and uses an OpenRouter LLM to synthesize a structured JSON output and an 11-section Markdown incident response report.
Validates that required report fields exist and, if valid, writes the structured output and Markdown report back to the Supabase test incident record; otherwise it skips the write.

Setup
Create Supabase tables for test incidents and vector stores (for resolved incidents and reference playbooks) and configure the matching SQL functions used for retrieval (for example, match_resolved_incidents_v1 and match_reference_playbooks_v1).
Add Supabase credentials in n8n and set the correct table names and query function names in the workflow’s configuration nodes.
Add Google Gemini (PaLM) API credentials and ensure the embedding model name used in the config (for example, models/gemini-embedding-001) is available to your account.
Add an OpenRouter API credential for the chat models used by the agents and synthesizer, and ensure your webhook caller sends an encrypted_openrouter_key value that matches the workflow’s decryption format.
Add a Tavily API credential for web search, then copy the webhook URL and configure your incident source to POST the incident JSON to it.

Nodes Used (12)

AI Agent
@n8n/n8n-nodes-langchain.agent
Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm
Code
n8n-nodes-base.code
Default Data Loader
@n8n/n8n-nodes-langchain.documentDefaultDataLoader
Embeddings Google Gemini
@n8n/n8n-nodes-langchain.embeddingsGoogleGemini
HTTP Request
n8n-nodes-base.httpRequest
OpenRouter Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenRouter
Recursive Character Text Splitter
@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter
Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured
Supabase
n8n-nodes-base.supabase
Supabase Vector Store
@n8n/n8n-nodes-langchain.vectorStoreSupabase
Supabase: Insert
@n8n/n8n-nodes-langchain.vectorStoreSupabaseInsert