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

# How webhooks and project events work

> Why to pair webhooks with GET /project_events, and what each one guarantees

When something happens in your project, such as a campaign being updated or a customer
unsubscribing, Pocketflows records a project event. You can read project events in two ways:

* **Webhooks** push each event to your server as it happens.
* **`GET /project_events`** lets you pull the events from the last 30 days whenever you ask.

Both return the same events, with the same `id`, `type` and `data`. Use webhooks to react quickly,
and the list endpoint to make sure you haven't missed anything.

## Why webhooks alone aren't enough

Webhooks are the fastest way to learn about an event, but some events can fail to reach you:

* **Retries end.** A failed delivery is retried for about 31 hours, then given up. If your server
  is down or returning errors for longer than that, those events are never delivered.
* **Your server can lose an event it accepted.** Pocketflows treats any `2xx` response as delivered
  and doesn't send that event again. If your code returns `2xx` and then fails to process the event,
  nothing will resend it.
* **Webhooks only receive new events.** A webhook gets the events created after you set it up, and
  only the event types you selected for it. Events from before then, or of other types, are never
  sent to it.

Every event is also kept for 30 days and listed by `GET /project_events`, whether or not a webhook
received it. Fetching the events you haven't seen yet closes each of these gaps.

## Using both

Handle webhooks as they arrive, and fetch new events from the API on a schedule, for example every
few minutes, to catch anything a webhook missed. Your handler will see some events twice, once from
each source, and webhook retries can repeat events too. Record the `id` of each event you have
processed and skip any you have already seen.

Don't rely on the order events reach you. Webhooks can arrive out of order, and an event can appear
in the list shortly after events created later than it.

If your integration can wait a few minutes to learn about events, you can skip webhooks and only
fetch new events from the API.

## Related

* [Fetch new events from the API](https://docs.pocketflows.com/how-to/fetch-new-project-events.md) for the requests to make.
* [Webhooks](https://docs.pocketflows.com/reference/webhooks.md) for the payload shape, retry schedule and event types.
* [`GET /project_events`](https://docs.pocketflows.com/api-reference/project-events/list-project-events) for the endpoint's
  parameters.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.