# Webhook

Firefly integrates with webhooks to provide real-time notifications for various events and alerts. This integration enables teams to receive updates about infrastructure changes, policy violations, drift detection, and other important events directly to their custom endpoints.

## Prerequisites

* A service or application that can receive webhook notifications.
* A valid webhook URL endpoint.
* (Optional) Custom credentials for authentication.

## Setup Procedure

1. Go to your service or app and generate an incoming webhook URL.
2. In Firefly, click **Settings > Integrations**.
3. Click **Add New > Webhook Integration**.
4. Enter a descriptive name in the **Nickname** field.
5. Add the Webhook URL.
6. (Optional) Add custom credentials.
7. Click **Next**.
8. Click **Done**.

## Response Schema

The webhook payload follows this JSON schema:

```json
{
  "accountId": string,
  "accountName": string,
  "assetType": string,
  "integrationId": string,
  "integrationIdentifier": string,
  "integrationName": string,
  "notificationType": string, // "Drift"|"UnmanagedResource"|"GhostResource"|"InsightDetected"
  "providerType": string, // "aws"|"gcp"|"azurerm"|""
  "region": string,
  "samples": [
    {
      "ARN": string,
      "FRN": string,
      "crawlerId": string,
      "drifts": [ // only present if notificationType == "Drift"
        {
          "iacType": string, // "terraform"|"cloudformation"|...
          "iacValue": string,
          "keyName": string,
          "providerValue": string
        }
      ],
      "firstSeen": string, // 1999-01-31T23:59:59.999999999Z format
      "inventoryUpdateTime": string, // 1999-01-31T23:59:59.999999999Z format
      "isChild": bool,
      "isCrawlerEventDriven": bool,
      "isExcluded": bool,
      "isLocked": bool,
      "lastResourceStateChange": string, // 1999-01-31T23:59:59.999999999Z format
      "name": string,
      "ownerData": {
        "ActionType": string,
        "eventName": string,
        "eventTime": string, // 1999-01-31T23:59:59.999999999Z format
        "otherOwnerData": null,
        "userIdentity": {
          "displayName": string,
          "initials": string,
          "type": string
        },
        "workflowId": string
      }
    }
  ],
  "workflowId": string
}
```

## Features Enabled

* **Real-time Notifications**: Receive immediate alerts for important events.
* **Custom Integration**: Integrate with any service that supports webhooks.
* **Flexible Authentication**: Support for custom credentials.
* **Rich Payload**: Detailed event information in JSON format.
* **Multiple Event Types**: Support for various notification types including drift detection and resource management.

> **Note:** In the integration settings page, use the notifcation test button to test the integration.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.firefly.ai/integrations/notifications/webhook.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
