# Connect a claim system

Write Attest's verdict, risk score and a console link onto Guidewire ClaimCenter and Duck Creek claim records, and open a case when a claim is created.

*Available on Enterprise.*

Use a claim-system connector to put Attest's verdict, risk score and a link back to the console onto the claim record your adjusters already work in. The connector also opens an Attest case when a new claim is created.

A connector is a small stateless service from `@provenanceauth/connectors`. It receives Attest's signed webhooks, verifies each signature, writes the mapped fields to Guidewire ClaimCenter or Duck Creek Claims, and ignores an event it has already handled. If the claim system is unavailable, it answers with a `5xx` so the webhook is retried.

**Before you begin:** a [webhook endpoint](https://provenanceauth.com/docs/integrate/webhooks.md) pointing at where the connector will run, subscribed to `attest.claim.provenance_updated` and `attest.case.status_changed`, and its signing secret. You also need API credentials for your claim system.

## 1. Run the connector

The `provenance-connector` service listens on port 8091 at `POST /webhooks/provenance`. Configure it with environment variables:

| Variable | Value |
| --- | --- |
| `CONNECTOR_PLATFORM` | `guidewire` or `duckcreek` |
| `PROVENANCE_WEBHOOK_SECRET` | The webhook endpoint's `whsec_…` secret |
| `PROVENANCE_DEEPLINK_BASE` | Your console URL, for the link on each claim |
| `PLATFORM_BASE_URL` | Your ClaimCenter Cloud API or Duck Creek base URL |
| `PLATFORM_TOKEN` | A ClaimCenter bearer token (Guidewire) |
| `PLATFORM_API_KEY` | A Duck Creek API key (Duck Creek) |

**This package isn't on npm yet.** Until then, every request in these docs runs over HTTP against the [sandbox](https://provenanceauth.com/docs/get-started/sandbox.md).

With access to the private Provenance repository, which your Provenance contact grants, install from it:

```bash
git clone https://github.com/michaelnbane-jpg/provenance.git provenance
cd provenance && pnpm install && pnpm build
node scripts/check-publishable.mjs --out ../provenance-packs
cd ../your-project
npm install ../provenance-packs/provenanceauth-sdk-1.0.0.tgz ../provenance-packs/provenanceauth-connectors-1.0.0.tgz
```

```bash
CONNECTOR_PLATFORM=guidewire \
PROVENANCE_WEBHOOK_SECRET=whsec_dv7-dPyLHZOWdkn-bWPXg59ZLpp9AO5O \
PROVENANCE_DEEPLINK_BASE=https://console.example.com \
PLATFORM_BASE_URL=https://claims.example.com/cc/rest \
PLATFORM_TOKEN=gw-token \
  npx --no provenance-connector
```

## 2. Choose the fields to write

Each connector ships a default map from webhook fields to claim-record fields. For Guidewire:

| ClaimCenter field | Webhook field |
| --- | --- |
| `ProvenanceRiskScore` | `data.overall_risk_score` |
| `ProvenanceStatus` | `data.overall_status` |
| `ProvenanceVerdict` | `data.verdict` |
| `ProvenanceCaseStatus` | `data.case_status` |

Every write also sets `provenance_deep_link` to the claim in the console. To use your own field names, run the connector in your own service with a custom map:

**Node**

```ts
import { createServer } from "node:http";
import { EventDedupe, handleProvenanceWebhook } from "@provenanceauth/connectors";
import { guidewireClient, guidewireConfig } from "@provenanceauth/connectors/guidewire";

const config = guidewireConfig({
  webhookSecret: process.env.PROVENANCE_WEBHOOK_SECRET!,
  deepLinkBase: "https://console.example.com",
  fieldMap: { Fraud_Risk_Score__c: "data.overall_risk_score", Media_Verdict__c: "data.overall_status" },
});
const client = guidewireClient({ baseUrl: process.env.PLATFORM_BASE_URL!, bearerToken: process.env.PLATFORM_TOKEN! });
const dedupe = new EventDedupe();

createServer(async (req, res) => {
  let body = "";
  for await (const chunk of req) body += chunk;
  const result = await handleProvenanceWebhook(config, body, req.headers["provenance-signature"] as string, client, dedupe);
  res.writeHead(result.status, { "Content-Type": "application/json" }).end(JSON.stringify(result.body));
}).listen(8091);
```

The handler verifies the signature over the exact request bytes, so pass the raw body.

## 3. Open a case when a claim is created

The reverse direction turns a claim-created event from your claim system into the fields for opening an Attest case:

**Node**

```ts
import { guidewireClaimToCaseOpen } from "@provenanceauth/connectors/guidewire";

const { claim_id, claim_type, state } = guidewireClaimToCaseOpen(claimCenterEvent);
// Attest then creates the case the first time the claim is viewed or attested.
```

**Limitations:** the connectors are tested against recorded ClaimCenter and Duck Creek API shapes. Run them against your claim system's test environment before production.

## Errors you might see

| Symptom | Cause | Fix |
| --- | --- | --- |
| The connector answers `401` | The webhook signature didn't verify | Check `PROVENANCE_WEBHOOK_SECRET` matches the endpoint's secret. |
| The connector answers `502` | The claim system rejected the write | Check the platform credentials; the webhook is retried. |
| A claim isn't updated | The event has no `claim_id`, or was already handled | Only claim events carry a claim; repeats are skipped by design. |

## See also

- [Webhooks](https://provenanceauth.com/docs/integrate/webhooks.md)
- [Cases and appeals](https://provenanceauth.com/docs/attest/guides/cases-and-appeals.md)
- [Insurance claims](https://provenanceauth.com/docs/attest/guides/review-claims.md)
