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

# PagerDuty Integration

> Connect PagerDuty to Anyshift so Annie can read your incidents, post acknowledgements, and automatically run root cause analysis when alerts fire.

<iframe width="560" height="315" src="https://www.youtube.com/embed/XLAeBr7PwPQ" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen />

## Overview

The PagerDuty integration gives Annie two capabilities:

* **API access** — Annie reads your incidents, acknowledges them, and leaves comments via a PagerDuty API token.
* **Real-time webhook** — When an `incident.triggered` event fires, Annie immediately starts a root cause analysis, cross-references recent infrastructure changes, and posts findings in your mapped Slack channel.

***

## Step 1: Add an API Token

1. In PagerDuty, go to **Integrations → API Access Keys → Create New API Key**.
2. Give it a descriptive name (e.g. `Anyshift-Annie`) and copy the key — it is only shown once.
3. In Anyshift, go to **Integrations → PagerDuty → New Token**, paste the key, and save.

Annie uses this token to fetch incident metadata, post acknowledgements, and add resolution comments.

***

## Step 2: Configure the Webhook

The webhook delivers real-time incident events to Anyshift. Annie only processes `incident.triggered` — other event types (`acknowledged`, `resolved`) are received and acknowledged but do not trigger analysis.

### Create the webhook in Anyshift

1. Go to **Integrations → PagerDuty → New Webhook**.
2. Enter a name (e.g. `prod-webhook`) and choose a secret key.
3. Copy the **Webhook URL** and the **Secret Key** — you need both in the next step.

### Register it in PagerDuty

1. In PagerDuty, go to **Integrations → Generic Webhooks (V3) → New Webhook**.
2. Paste the Anyshift webhook URL.
3. Under **Scope**, select the services or the full account you want Annie to monitor.
4. Set the **Event type** to `incident.triggered`.
5. In the **Signature Secret** field, paste the secret key you set in Anyshift.

<Tip>
  Anyshift verifies every incoming request using HMAC-SHA256 against the secret key. Requests with missing or invalid signatures are rejected before any processing occurs.
</Tip>

***

## What happens when an incident fires

When Anyshift receives an `incident.triggered` event:

1. **Signature verification** — the request is validated against the shared secret. Invalid requests are dropped immediately.
2. **Deduplication** — if the same PagerDuty incident ID has already been processed, the event is silently acknowledged to prevent duplicate RCAs.
3. **Context assembly** — Annie retrieves the last 30–60 minutes of Slack messages, recent AWS resource changes, and prior incidents with completed analyses to build a context window.
4. **Routing decision** — Annie's router decides whether to run a full RCA, start a conversational thread, or skip the incident (e.g. for known-noisy alert patterns). [Automation](/pages/product/customization/instructions) rules can override this default.
5. **Analysis delivery** — if RCA is triggered, Annie posts real-time progress updates in the mapped Slack channel thread, then delivers a final summary with a timeline, likely root cause, and recommended remediation steps.

See [Root Cause Analysis](/pages/product/root_cause_analysis) for a full walkthrough of the analysis pipeline.

***

## Verify the connection

Trigger a test incident in PagerDuty. Within a few seconds Annie should post an analysis thread in the Slack channel mapped to the same Anyshift project. The incident also appears in Anyshift under **Incidents**.

<Tip>
  Make sure the Slack channel where you want Annie to post is mapped to the correct Anyshift project, and that your PagerDuty bot is registered in the **Annie On-Call Registry** for that channel. See [Slack Integration](/pages/product/integration/slack) for setup details.
</Tip>

***

## Customize Annie's behavior

By default Annie decides automatically whether to run RCA or start a chat based on the incident context. You can override this per project using [Automation](/pages/product/customization/instructions):

* **Force RCA** for all incidents from a specific service.
* **Suppress** noisy or low-signal alert patterns.
* **Trigger a custom report** instead of a standard RCA.
* **Silence** Annie for specific channels or time windows.
