Quick overview
This workflow accepts a research query via webhook, breaks it into sub-questions with Anthropic Claude, gathers web results via SerpAPI, synthesizes a cited report, scores confidence, and then saves the report to Google Docs, notifies Slack, and logs the run to Postgres.
How it works
- Receives a POST webhook request containing a research query.
- Uses Anthropic Claude to generate 3–5 focused sub-questions and splits them into individual search tasks.
- Queries Google results via SerpAPI for each sub-question and aggregates the returned organic results.
- Uses Anthropic Claude to synthesize the aggregated search results into a structured research report with inline URL citations.
- Uses Anthropic Claude to score the report’s overall confidence and identify any low-confidence claims.
- Creates a Google Doc for the research report, posts either a high-confidence or human-review Slack notification based on the confidence threshold, and stores the run metadata (query, doc URL, confidence, low-confidence count) in Postgres.
Setup
- Create an Anthropic (Claude) credential in n8n for the three AI steps (planning, synthesis, and confidence scoring).
- Add a SerpAPI API key and set it in the workflow configuration value used by the SerpAPI HTTP request.
- Connect your Google Docs account in n8n and ensure the account has permission to create documents in the target Google Drive.
- Add a Slack credential, set the Slack channel ID in the workflow configuration value, and ensure the bot can post to that channel.
- Configure the Postgres credential and ensure a
public.research_runs table exists with columns matching the inserted fields (query, created_at, report_url, overall_confidence, low_confidence_count).