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

# Datadog

> Use webhooks to monitor Prequel events directly in your Datadog.

Use this guide to understand Prequel webhook events sent as Datadog Events.

## Overview

Prequel supports sending webhook events directly to Datadog as events. When you create a webhook endpoint of type `datadog`, Prequel will POST a JSON payload to the [Datadog Events v1 API](https://docs.datadoghq.com/api/latest/events/#post-an-event), using your Datadog API key. The webhook can be easily configured directly in the Prequel Admin UI.

## Payload structure

The payload sent to Datadog depends on the event type:

* **Transfer Event Types** (`transfer.success`, `transfer.error`, `transfer.cancelled`):
  * `title`: A string describing the event, e.g. `"transfer.success for <transfer_id>"`
  * `text`: The transfer log (truncated to 3000 characters if necessary)
  * `tags`: Array of tags, including:
    * `service:prequel`
    * `event_type:<event_type>`
    * `transfer_id:<transfer_id>`
    * `destination_id:<destination_id>`
    * `destination_name:<destination_name>`
    * `id_in_provider_system:<id_in_provider_system>`
    * `transfer_status:<transfer_status>`
    * `rows_transferred:<rows_transferred>`
    * `env:<org_environment>`: available values are: `"staging"` and `"production"`
    * `host:<deployment_domain>`: the domain of the Prequel deployment that sent the event (e.g. `app.prequel.co`)
    * (optional) `transfer_blamed_party:<blamed_party>`: available values are: `"first_party"`, `"third_party"`, `"prequel"`, and `"unknown"`
  * `date_happened`: Unix timestamp of the event
  * `alert_type`: `"info"` for success, `"error"` for error, `"user_update"` for cancelled

* **Other Resource Event Types** (e.g. source, destination, recipient, magic link):
  * `title`: `<event_type> for <resource_name>`
  * `text`: The event type, with dots replaced by spaces (e.g. `"recipient created"`)
  * `tags`: Array of tags, including:
    * `service:prequel`
    * `event_type:<event_type>`
    * `resource_name:<resource_name>`
    * `env:<org_environment>`: available values are: `"staging"`, `"production"`
    * `host:<deployment_domain>`: the domain of the Prequel deployment that sent the event (e.g. `app.prequel.co`)
  * `date_happened`: Unix timestamp of the event
  * `alert_type`: `"user_update"`

## Example Datadog payloads

**Transfer Success Example:**

```json title="Transfer success payload" icon="brackets-curly" expandable theme={null}
{
  "title": "transfer.success for 00000000-0000-0000-0000-000000000000",
  "text": "mock_data - succeeded",
  "tags": [
    "service:prequel",
    "event_type:transfer.success",
    "transfer_id:00000000-0000-0000-0000-000000000000",
    "destination_id:00000000-0000-0000-0000-000000000000",
    "destination_name:My Destination",
    "id_in_provider_system:dest_123",
    "transfer_status:SUCCESS",
    "rows_transferred:1000",
    "env:production",
    "host:app.prequel.co"
  ],
  "date_happened": 1708099148,
  "alert_type": "info"
}
```

**Resource Event Example:**

```json title="Resource event payload" icon="brackets-curly" expandable theme={null}
{
  "title": "recipient.created for Acme Inc",
  "text": "recipient created",
  "tags": [
    "service:prequel",
    "event_type:recipient.created",
    "resource_name:Acme Inc",
    "env:production",
    "host:app.prequel.co"
  ],
  "date_happened": 1708099148,
  "alert_type": "user_update"
}
```

## Authentication

The Datadog API key is required for Prequel to send events Datadog. You must provide this key when creating the webhook.
