See llms.txt for all machine-readable content.

Back to Templates

Investigate Sentry incidents with Google Gemini, Postgres, GitHub and Slack

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

  1. 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).
  2. Checks Postgres to see if an investigation record already exists for the same Sentry issue ID and proceeds only if it is new.
  3. Fetches the latest issue details from Sentry and retrieves recent commits from the configured GitHub repository.
  4. Searches Postgres for up to 10 similar historical incidents based on the current issue title and recent incident reports.
  5. 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.
  6. Validates and scores the AI output, then upserts the full investigation (evidence and report) into Postgres.
  7. Posts an incident summary message to a Slack channel with severity, confidence, and a link back to the Sentry issue.

Setup

  1. Configure your Sentry integration to send issue alert webhooks to this workflow’s webhook URL and ensure the payload includes a Sentry issue ID.
  2. Add Sentry API credentials in n8n so the workflow can fetch issue details.
  3. Add GitHub API credentials and update the repository URL/owner/name used to fetch recent commits.
  4. 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.
  5. Add a Google Gemini (PaLM) API credential for the chat model used by the AI agent.
  6. Add Slack OAuth credentials and set the target channel for posting the incident summary.