> ## 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.

# Webhooks

> Real-time notifications for events that happen in your Pocketflows project

Pocketflows can deliver webhooks to your server whenever certain events occur in
your project. This allows you to react to changes — such as a campaign being
updated — without polling the API.

## Payload shape

Every webhook delivery has the same top-level shape:

**id** `string`

The ID of the event (prefixed `pe_`).

**type** `string`

The event type. See the full list below.

**data** `object`

The event payload. The shape depends on `type`.

Example:

```json theme={null}
{
  "id": "pe_abc123",
  "type": "campaign.updated",
  "data": { "...": "..." }
}
```

## Event types

### Customer

#### `customer.unsubscribe`

Fires when a customer unsubscribes, through an email's unsubscribe link, an unsubscribe embed, or
`POST /customers/:id/unsubscribe`. It doesn't fire when a customer replies STOP to a text. See
[Respect customer consent](https://docs.pocketflows.com/how-to/manage-customer-consent.md).

`data` contains:

**business** `string`

The ID of the customer's business.

**customer** `string`

The ID of the customer.

**unsubscribe\_type** `string`

`future` when the customer unsubscribed from all current and future campaigns and triggers,
`campaign` for a single campaign, or `trigger` for a single trigger.

**campaign** `string`

The ID of the campaign, when `unsubscribe_type` is `campaign`.

**trigger** `string`

The ID of the trigger, when `unsubscribe_type` is `trigger`.

An unsubscribe with the `all` type sends one event for each campaign and trigger the customer was
unsubscribed from.

### Campaign

#### `campaign.created`

Fires when a new campaign is created. `data` is the
[Campaign](https://docs.pocketflows.com/email_and_sms/campaigns/schema) object.

#### `campaign.updated`

Fires when an existing campaign is updated. `data` is the
[Campaign](https://docs.pocketflows.com/email_and_sms/campaigns/schema) object.

#### `campaign.deleted`

Fires when a campaign is deleted. `data` is the
[Campaign](https://docs.pocketflows.com/email_and_sms/campaigns/schema) object as it existed at the time of
deletion.

### Trigger

#### `trigger.created`

Fires when a new trigger is created. `data` is the
[Trigger](https://docs.pocketflows.com/email_and_sms/triggers/schema) object.

#### `trigger.updated`

Fires when an existing trigger is updated. `data` is the
[Trigger](https://docs.pocketflows.com/email_and_sms/triggers/schema) object.

#### `trigger.deleted`

Fires when a trigger is deleted. `data` is the
[Trigger](https://docs.pocketflows.com/email_and_sms/triggers/schema) object as it existed at the time of
deletion.

### Segment

#### `segment.created`

Fires when a new segment is created. `data` is the
[Segment](https://docs.pocketflows.com/base/segments/schema) object.

#### `segment.updated`

Fires when an existing segment is updated. `data` is the
[Segment](https://docs.pocketflows.com/base/segments/schema) object.

#### `segment.deleted`

Fires when a segment is deleted. `data` is the [Segment](https://docs.pocketflows.com/base/segments/schema)
object as it existed at the time of deletion.


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