# Create & Manage Advocate Webhook Subscriptions

Webhooks are code that executes when an event happens. Advocate allows you to use webhooks to register a URL that we will POST to any time an event happens in your program, e.g., when a vanity coupon code is created for a new participant, an event object is created. There are two methods for creating and managing webhooks: [via the Advocate API](https://integrations.impact.com/impact-brand/docs/api-webhooks) or in the Advocate platform. This help article will explain how to manage webhooks through the Advocate platform.

#### Create a webhook subscription

1. From the top navigation bar, select ![](https://4048883401-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2Fgit-blob-1183576591b45997efe4dc81a25024640591d02a%2F245137dc972a7a7f6165b59538fcdbac8fd5bd8fee4ba9f20c1a2982c5b58b57.svg?alt=media) **\[User profile] → Settings**.&#x20;
2. In the left column below *Advocate Settings*, select **Webhooks**.
3. On the *Webhook Subscriptions* page, select **Create Subscription**.
4. Below *Post to URL*, enter the unique address the application uses to send real-time updates about specific events.
5. Optionally, below *Webhook Name*, enter the name of the new webhook subscription.
6. Select **Save**.

#### Troubleshoot webhook logs

When you register a URL to which Advocate posts whenever an event happens in your program, you can review the logs and troubleshoot any webhook events that fail.

**Access your webhook logs**

1. From the top navigation bar, select ![](https://4048883401-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwMLlMoFBtKJa8ptd3zaw%2Fuploads%2Fgit-blob-1183576591b45997efe4dc81a25024640591d02a%2F245137dc972a7a7f6165b59538fcdbac8fd5bd8fee4ba9f20c1a2982c5b58b57.svg?alt=media) **\[User profile] → Settings**.&#x20;
2. In the left column below *Advocate Settings*, select **Webhooks**.
3. On the *Webhook Subscriptions* page, select **View Logs**.
4. Use the filters below *Webhooks Event Log* to filter the webhooks.
   * Refer to the *Filter reference* below for more information.

<details>

<summary>Filter reference</summary>

| Filter | Description                                                                                                                                                      |
| ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Type   | Filter for the webhook [event type](https://integrations.impact.com/impact-brand/docs/api-webhooks#section-webhook-events). This filter defaults to *All Types*. |
| Period | Filter for the period in which the webhook was last updated. This filter defaults to *All time*.                                                                 |

</details>

**View webhook details**

1. Select a specific webhook to open the *Webhook Details* view.
2. This view provides information that can be used to troubleshoot a webhook subscription.
   * Refer to the *Event reference* below for more information.

<details>

<summary>Event reference</summary>

| Filter               | Description                                                                                                                                                                                                                                                                                                                                   |
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Type                 | The webhook [event type](https://integrations.impact.com/impact-brand/docs/api-webhooks#section-webhook-events).                                                                                                                                                                                                                              |
| Webhook ID           | The webhook's unique identifier.                                                                                                                                                                                                                                                                                                              |
| Date Created         | The date on which the webhook was created.                                                                                                                                                                                                                                                                                                    |
| Event Data           | The webhook [payload](https://integrations.impact.com/impact-brand/docs/api-webhooks#section-payloads).                                                                                                                                                                                                                                       |
| Subscription(s)      | Webhook subscriptions to which the webhook was sent and their status.                                                                                                                                                                                                                                                                         |
| Subscription Details | Details about the response received from the webhook subscription endpoint. Details can include webhook's delivery attempt, showing the timestamp of the attempt, the HTTP status code received from the destination, and whether the attempt timed out due to the request taking too long to receive a response from the destination server. |

</details>

**Webhook retry system for failed event deliveries**

* Rest hooks are delivered immediately after an event is triggered. If the endpoint does not successfully respond to a delivery attempt (i.e., respond with a status code other than 200), the delivery will be considered as failed.
* Failed deliveries will be reattempted every hour after the previous failed attempt until either a successful delivery is made or until 72 attempts have been made (approximately 3 days at the rate of 1 retry per hour).
* Webhook endpoints that consistently return errors will be automatically disabled after the following number of errors:

  | Status code | Errors received |
  | ----------- | --------------- |
  | 4xx errors  | 1000            |
  | 5xx errors  | 2000            |
  | 3xx errors  | 2000            |
