> ## Documentation Index
> Fetch the complete documentation index at: https://docs.devin.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Sentry Integration

> Connect Devin to Sentry for automated error triage and remediation

## Overview

Sentry is an official MCP integration available in the [MCP Marketplace](/work-with-devin/mcp). It uses OAuth authentication, giving Devin access to your Sentry projects so it can query issue details, stack traces, event breadcrumbs, and more.

Once connected, you can set up automated error triage through webhooks or schedule recurring remediation sessions that process Sentry errors in batch.

## Enable the Sentry MCP

<Steps>
  <Step title="Open the MCP Marketplace">
    Go to **Settings > MCP Marketplace** and find **Sentry**.
  </Step>

  <Step title="Complete the OAuth flow">
    Click **Enable** and authenticate with the Sentry account that has access to your projects. This grants Devin read access to your Sentry issues, events, and stack traces.
  </Step>

  <Step title="Verify the connection">
    Test the connection by starting a session and asking Devin to list recent issues in one of your projects. You can also click **Test listing tools** in the MCP Marketplace to confirm connectivity.
  </Step>
</Steps>

## Capabilities

Once the Sentry MCP is enabled, Devin can perform the following actions within any session:

| Capability                  | Description                                                 |
| :-------------------------- | :---------------------------------------------------------- |
| Query issue details         | View issue metadata, status, assignment, and event counts   |
| Pull full stack traces      | Access complete stack traces for any event                  |
| Read event breadcrumbs      | View user actions and system events leading up to an error  |
| Inspect release tags        | Check which release introduced or resolved an issue         |
| Update issue status         | Mark issues as resolved, ignored, or assign to team members |
| Manage assignments and tags | Update issue assignments, tags, and bookmarks               |
| Configure alerts            | View and manage alert rules and notification settings       |

## Auto-Triage Pipeline (Webhook-driven)

You can wire Sentry alerts directly to Devin so that new production errors are triaged automatically. This uses a Sentry Internal Integration to deliver webhooks to a bridge service that calls the Devin API.

<Steps>
  <Step title="Create a Sentry Internal Integration">
    In your Sentry dashboard, go to **Settings > Developer Settings > Custom Integrations** and click **Create New Integration > Internal Integration**.

    Configure it:

    * **Name:** `Devin Auto-Triage`
    * **Webhook URL:** The endpoint for your bridge service (e.g., `https://your-domain.com/sentry-webhook`)
    * **Alert Rule Action:** Toggle **on** — this makes the integration available as an action in alert rules
    * **Permissions:** Read access to **Issue & Event** and **Project**
  </Step>

  <Step title="Create an alert rule">
    Go to **Alerts > Create Alert Rule > Issue Alert** for your project:

    * **When:** A new issue is created
    * **If:** The issue has more than **50** events in **1 hour** (adjust to your traffic)
    * **Then:** Send a notification via **Devin Auto-Triage**
  </Step>

  <Step title="Deploy a webhook handler">
    Build a small handler that receives Sentry's alert payload and starts a Devin session. Create a [service user](/api-reference/v3/overview) in **Settings > Service Users** with `ManageOrgSessions` permission (add `ViewOrgSessions` too if you want to list or filter sessions via the API). Store the API token as `DEVIN_API_KEY`, your organization ID as `DEVIN_ORG_ID`, and your Sentry Internal Integration's **Client Secret** as `SENTRY_CLIENT_SECRET` in your handler's environment.

    ```javascript theme={null}
    const express = require('express');
    const crypto = require('crypto');
    const app = express();
    app.use(express.json({
      verify: (req, _res, buf) => { req.rawBody = buf; },
    }));

    function verifySignature(req) {
      const signature = req.headers['sentry-hook-signature'];
      if (!signature) return false;
      const expected = crypto
        .createHmac('sha256', process.env.SENTRY_CLIENT_SECRET)
        .update(req.rawBody)
        .digest('hex');
      if (signature.length !== expected.length) return false;
      return crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected));
    }

    app.post('/sentry-webhook', async (req, res) => {
      if (!verifySignature(req)) return res.status(401).send('Bad signature');

      const event = req.body.data?.event;
      if (!event) return res.sendStatus(200);

      const orgId = process.env.DEVIN_ORG_ID;
      const response = await fetch(
        `https://api.devin.ai/v3/organizations/${orgId}/sessions`, {
        method: 'POST',
        headers: {
          'Authorization': `Bearer ${process.env.DEVIN_API_KEY}`,
          'Content-Type': 'application/json',
        },
        body: JSON.stringify({
          prompt: [
            `A Sentry alert fired for a new issue: "${event.title}"`,
            `Culprit: ${event.culprit}`,
            `Sentry URL: ${event.web_url}`,
            ``,
            `Use the Sentry MCP to pull the full stack trace and breadcrumbs.`,
            `Identify the root cause, fix the issue, and open a PR with a`,
            `regression test.`,
          ].join('\n'),
          tags: ['sentry-auto-triage', `project:${event.project}`],
        }),
      });

      const { session_id } = await response.json();
      console.log(`Started Devin session ${session_id} for: ${event.title}`);
      res.sendStatus(200);
    });

    app.listen(3000);
    ```

    Deploy this anywhere that can receive HTTPS traffic — a Cloudflare Worker, AWS Lambda, or a small VPS. Point your Sentry Internal Integration's webhook URL to it.
  </Step>

  <Step title="Test the pipeline">
    Trigger a test alert in Sentry (or lower your threshold temporarily), then check [app.devin.ai](https://app.devin.ai) for a new session tagged `sentry-auto-triage`.
  </Step>
</Steps>

<Note>
  The code above tags each session with `sentry-auto-triage` and the Sentry project name. This lets you filter these sessions in the Devin dashboard and [pull them via the API](/api-reference/v3/sessions/organizations-sessions) using the `tags` query parameter. Listing sessions requires the `ViewOrgSessions` permission on your service user — see the [API overview](/api-reference/v3/overview) for the full permissions table.
</Note>

## Scheduled Batch Remediation

Instead of reacting to individual alerts, you can schedule a recurring [Devin](/work-with-devin/advanced-capabilities) session that pulls unresolved Sentry errors in batch and spawns fix sessions for each one.

<Steps>
  <Step title="Create a schedule">
    Go to **Settings > [Schedules](/product-guides/scheduled-sessions)** and click **Create schedule**.

    * **Name**: `Daily Sentry remediation`
    * **Frequency**: Daily at 6:00 AM (so fix PRs are ready before standup)
    * **Agent**: Devin — this lets Devin spawn a separate session for each error, so fixes run in parallel
    * **Prompt**:

    ```
    Use the Sentry MCP to pull all unresolved errors from the past
    24 hours in the payments-api project, sorted by event count.
    Skip errors tagged `wontfix` or `expected-behavior`.

    For the top 5 errors:
    1. Pull the full stack trace and breadcrumbs
    2. Find the relevant source files in our repo
    3. Identify the root cause
    4. Start a Devin session to open a PR with a fix and a regression
       test, linking the Sentry issue URL in the PR description

    Post a summary of all errors and their PRs to Slack.
    ```
  </Step>

  <Step title="Review and iterate">
    After a week of runs, adjust the scope:

    * **Increase or decrease the error count** based on how many fixes are mergeable
    * **Filter by project or tag** to focus on specific areas of your codebase
    * **Add [Knowledge](/product-guides/knowledge)** about your error-handling conventions so Devin's fixes match your team's patterns
  </Step>
</Steps>

<Tip>
  Combine webhook-driven triage for high-impact errors (50+ events/hour) with scheduled batch remediation for the long tail of lower-frequency issues. This ensures both urgent and ongoing errors are addressed.
</Tip>

## Related Resources

* [Full walkthrough: Auto-Triage Sentry Errors](/use-cases/gallery/api-sentry-auto-triage)
* [Full walkthrough: Daily Sentry Error Fixes](/use-cases/gallery/scheduled-sentry-remediation)
* [MCP Marketplace docs](/work-with-devin/mcp)
* [Devin API Reference](/api-reference/overview)
