Quick overview
This workflow receives Sentry issue alert webhooks, gathers related context from Sentry, GitHub, and a Postgres incident database, then uses Google Gemini to generate a structured incident investigation report, saves it back to Postgres, and posts a summary to Slack.
How it works
- Receives a POST webhook from Sentry when an issue alert fires and normalizes the payload into a consistent incident context (issue ID, title, environment, and links).
- Checks Postgres to see if an investigation record already exists for the same Sentry issue ID and proceeds only if it is new.
- Fetches the latest issue details from Sentry and retrieves recent commits from the configured GitHub repository.
- Searches Postgres for up to 10 similar historical incidents based on the current issue title and recent incident reports.
- Bundles the Sentry issue data, GitHub commit context, and historical incidents and sends the evidence to Google Gemini to produce a JSON investigation report with severity, hypotheses, and recommended actions.
- Validates and scores the AI output, then upserts the full investigation (evidence and report) into Postgres.
- Posts an incident summary message to a Slack channel with severity, confidence, and a link back to the Sentry issue.
Setup
- Configure your Sentry integration to send issue alert webhooks to this workflow’s webhook URL and ensure the payload includes a Sentry issue ID.
- Add Sentry API credentials in n8n so the workflow can fetch issue details.
- Add GitHub API credentials and update the repository URL/owner/name used to fetch recent commits.
- Set up a Postgres database with an
incident_investigations table matching the fields used in the SELECT and INSERT/UPSERT queries, then add your Postgres credentials in n8n.
- Add a Google Gemini (PaLM) API credential for the chat model used by the AI agent.
- Add Slack OAuth credentials and set the target channel for posting the incident summary.