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

# Webhooks

> Unipile incoming webhooks: event paths, payloads, and response data.

The Unipile plugin handles incoming webhooks. Point your provider’s subscription URL at your Corsair HTTP handler (see [Overview](https://docs.corsair.dev/plugins/unipile/overview.md) for setup context and the exact URL shape).

> [!NOTE]
>
> **New to Corsair?** See [webhooks](https://docs.corsair.dev/concepts/webhooks.md) and [hooks](https://docs.corsair.dev/concepts/hooks.md).

## Webhook map

* `accounts`
  * `add` (`accounts.add`)
  * `initialSyncCompleted` (`accounts.initialSyncCompleted`)
  * `initialSyncFailed` (`accounts.initialSyncFailed`)
  * `initialSyncRunning` (`accounts.initialSyncRunning`)
  * `locked` (`accounts.locked`)
  * `reconnect` (`accounts.reconnect`)
  * `remove` (`accounts.remove`)
  * `statusDegraded` (`accounts.statusDegraded`)
  * `statusDisconnected` (`accounts.statusDisconnected`)
  * `statusErrored` (`accounts.statusErrored`)
  * `statusPartial` (`accounts.statusPartial`)
  * `statusRunning` (`accounts.statusRunning`)
  * `unlocked` (`accounts.unlocked`)
* `calendarEvents`
  * `delete` (`calendarEvents.delete`)
  * `new` (`calendarEvents.new`)
  * `update` (`calendarEvents.update`)
* `calendars`
  * `create` (`calendars.create`)
  * `delete` (`calendars.delete`)
  * `update` (`calendars.update`)
* `chats`
  * `delete` (`chats.delete`)
  * `update` (`chats.update`)
* `emailDrafts`
  * `delete` (`emailDrafts.delete`)
  * `new` (`emailDrafts.new`)
* `emailFolders`
  * `create` (`emailFolders.create`)
  * `delete` (`emailFolders.delete`)
  * `update` (`emailFolders.update`)
* `emails`
  * `bounce` (`emails.bounce`)
  * `delete` (`emails.delete`)
  * `new` (`emails.new`)
* `followers`
  * `new` (`followers.new`)
* `messages`
  * `delete` (`messages.delete`)
  * `new` (`messages.new`)
  * `reactionDelete` (`messages.reactionDelete`)
  * `reactionNew` (`messages.reactionNew`)
  * `receiptDelivery` (`messages.receiptDelivery`)
  * `receiptRead` (`messages.receiptRead`)
  * `update` (`messages.update`)
* `relations`
  * `new` (`relations.new`)
* `tracking`
  * `click` (`tracking.click`)
  * `open` (`tracking.open`)

## HTTP handler setup

```ts app/api/webhook/route.ts theme={null}
import { processWebhook } from "corsair";
import { corsair } from "@/server/corsair";

export async function POST(request: Request) {
    const headers = Object.fromEntries(request.headers);
    const body = await request.json();
    const result = await processWebhook(corsair, headers, body);
    return result.response;
}
```

## Events

## Accounts

### Add

`accounts.add`

A new account was connected and is ready; payload.state is the createAuthLink state

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `account.add` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   account: {
>     object?: string | null,
>     id: string,
>     name?: string | null,
>     user_id?: string | null,
>     provider: string,
>     status: string,
>     is_locked?: boolean | null,
>     created_at?: string | null,
>     application_id?: string | null,
>     account_scope_id?: string | null,
>     metadata?: {
>       connection_method?: string | null,
>       products_connection_status?: {
>       } | null,
>       custom_data?: {
>       } | null
>     } | null
>   },
>   state?: string | null
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: account.add,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     account: {
>       object?: string | null,
>       id: string,
>       name?: string | null,
>       user_id?: string | null,
>       provider: string,
>       status: string,
>       is_locked?: boolean | null,
>       created_at?: string | null,
>       application_id?: string | null,
>       account_scope_id?: string | null,
>       metadata?: {
>         connection_method?: string | null,
>         products_connection_status?: {
>         } | null,
>         custom_data?: {
>         } | null
>       } | null
>     },
>     state?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        accounts: {
            add: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Initial Sync Completed

`accounts.initialSyncCompleted`

The first sync finished and all history is available

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `account.initial_sync.completed` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   timestamp: string
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: account.initial_sync.completed,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     timestamp: string
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        accounts: {
            initialSyncCompleted: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Initial Sync Failed

`accounts.initialSyncFailed`

The first sync stopped with an error

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `account.initial_sync.failed` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   timestamp: string
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: account.initial_sync.failed,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     timestamp: string
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        accounts: {
            initialSyncFailed: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Initial Sync Running

`accounts.initialSyncRunning`

The first sync of a newly connected account started

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `account.initial_sync.running` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   timestamp: string
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: account.initial_sync.running,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     timestamp: string
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        accounts: {
            initialSyncRunning: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Locked

`accounts.locked`

API access to an account was locked

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `account.locked` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   timestamp: string
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: account.locked,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     timestamp: string
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        accounts: {
            locked: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Reconnect

`accounts.reconnect`

An existing account was signed in again or reconfigured

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `account.reconnect` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   account: {
>     object?: string | null,
>     id: string,
>     name?: string | null,
>     user_id?: string | null,
>     provider: string,
>     status: string,
>     is_locked?: boolean | null,
>     created_at?: string | null,
>     application_id?: string | null,
>     account_scope_id?: string | null,
>     metadata?: {
>       connection_method?: string | null,
>       products_connection_status?: {
>       } | null,
>       custom_data?: {
>       } | null
>     } | null
>   },
>   state?: string | null
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: account.reconnect,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     account: {
>       object?: string | null,
>       id: string,
>       name?: string | null,
>       user_id?: string | null,
>       provider: string,
>       status: string,
>       is_locked?: boolean | null,
>       created_at?: string | null,
>       application_id?: string | null,
>       account_scope_id?: string | null,
>       metadata?: {
>         connection_method?: string | null,
>         products_connection_status?: {
>         } | null,
>         custom_data?: {
>         } | null
>       } | null
>     },
>     state?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        accounts: {
            reconnect: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Remove

`accounts.remove`

An account was removed from Unipile

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `account.remove` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   account: {
>     id: string
>   }
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: account.remove,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     account: {
>       id: string
>     }
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        accounts: {
            remove: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Status Degraded

`accounts.statusDegraded`

A multi-product account has one product running and another interrupted

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `account.status.degraded` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   timestamp: string,
>   product?: string | null,
>   reason?: string | null
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: account.status.degraded,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     timestamp: string,
>     product?: string | null,
>     reason?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        accounts: {
            statusDegraded: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Status Disconnected

`accounts.statusDisconnected`

An account needs signing in again; send a reconnect link from accounts.createAuthLink

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `account.status.disconnected` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   timestamp: string,
>   product?: string | null
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: account.status.disconnected,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     timestamp: string,
>     product?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        accounts: {
            statusDisconnected: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Status Errored

`accounts.statusErrored`

An account is interrupted by a Unipile, proxy or provider problem

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `account.status.errored` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   timestamp: string,
>   product?: string | null,
>   reason?: string | null
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: account.status.errored,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     timestamp: string,
>     product?: string | null,
>     reason?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        accounts: {
            statusErrored: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Status Partial

`accounts.statusPartial`

A multi-product account has one product running and another needing sign-in

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `account.status.partial` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   timestamp: string,
>   product?: string | null
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: account.status.partial,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     timestamp: string,
>     product?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        accounts: {
            statusPartial: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Status Running

`accounts.statusRunning`

An account (or one of its products) is working again

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `account.status.running` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   timestamp: string,
>   product?: string | null
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: account.status.running,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     timestamp: string,
>     product?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        accounts: {
            statusRunning: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Unlocked

`accounts.unlocked`

API access to an account was restored

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `account.unlocked` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   timestamp: string
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: account.unlocked,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     timestamp: string
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        accounts: {
            unlocked: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

## Calendar Events

### Delete

`calendarEvents.delete`

A calendar event was deleted

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `calendar.event.delete` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   calendar_id: string,
>   id: string
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: calendar.event.delete,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     calendar_id: string,
>     id: string
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        calendarEvents: {
            delete: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### New

`calendarEvents.new`

A calendar event was created or the account was invited (Google and Outlook can report it up to 60 seconds late)

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `calendar.event.new` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   id: string,
>   calendar_id?: string | null,
>   title?: string | null,
>   is_cancelled?: boolean | null,
>   start?: any,
>   end?: any
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: calendar.event.new,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     id: string,
>     calendar_id?: string | null,
>     title?: string | null,
>     is_cancelled?: boolean | null,
>     start?: any,
>     end?: any
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        calendarEvents: {
            new: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Update

`calendarEvents.update`

A calendar event was changed

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `calendar.event.update` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   id: string,
>   calendar_id?: string | null,
>   title?: string | null,
>   is_cancelled?: boolean | null,
>   start?: any,
>   end?: any
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: calendar.event.update,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     id: string,
>     calendar_id?: string | null,
>     title?: string | null,
>     is_cancelled?: boolean | null,
>     start?: any,
>     end?: any
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        calendarEvents: {
            update: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

## Calendars

### Create

`calendars.create`

A calendar was created

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `calendar.create` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   id: string,
>   name?: string | null,
>   is_default?: boolean | null
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: calendar.create,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     id: string,
>     name?: string | null,
>     is_default?: boolean | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        calendars: {
            create: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Delete

`calendars.delete`

A calendar was deleted

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `calendar.delete` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   id: string
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: calendar.delete,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     id: string
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        calendars: {
            delete: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Update

`calendars.update`

A calendar was changed

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `calendar.update` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   id: string,
>   name?: string | null,
>   is_default?: boolean | null
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: calendar.update,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     id: string,
>     name?: string | null,
>     is_default?: boolean | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        calendars: {
            update: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

## Chats

### Delete

`chats.delete`

A chat was deleted

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `chat.delete` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   id: string
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: chat.delete,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     id: string
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        chats: {
            delete: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Update

`chats.update`

A chat changed: folders, unread count, archive state, participants or name

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `chat.update` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   object?: string | null,
>   id: string,
>   name?: string | null,
>   type?: string | null,
>   provider?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null,
>   last_message_timestamp?: string | null,
>   unread_count?: number | null,
>   is_archived?: boolean | null,
>   is_readonly?: boolean | null,
>   is_group?: boolean | null,
>   is_1to1?: boolean | null,
>   participants_count?: number | null,
>   restrictions?: string[] | null,
>   folders?: string[] | null,
>   user?: {
>     id: string,
>     object?: string | null,
>     type?: string | null,
>     public_identifier?: string | null,
>     display_name?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     profile_url?: string | null,
>     public_picture_url?: string | null,
>     description?: string | null,
>     specifics?: {
>       location?: string | null,
>       network_distance?: string | null,
>       industry?: string | null,
>       is_following?: boolean | null,
>       followers_count?: number | null,
>       relations_count?: number | null,
>       shared_relations_count?: number | null,
>       is_premium?: boolean | null,
>       is_verified?: boolean | null
>     } | null
>   } | null,
>   participants?: {
>     id: string,
>     object?: string | null,
>     type?: string | null,
>     public_identifier?: string | null,
>     display_name?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     profile_url?: string | null,
>     public_picture_url?: string | null,
>     description?: string | null,
>     specifics?: {
>       location?: string | null,
>       network_distance?: string | null,
>       industry?: string | null,
>       is_following?: boolean | null,
>       followers_count?: number | null,
>       relations_count?: number | null,
>       shared_relations_count?: number | null,
>       is_premium?: boolean | null,
>       is_verified?: boolean | null
>     } | null
>   }[] | null,
>   last_message?: {
>   } | null
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: chat.update,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     object?: string | null,
>     id: string,
>     name?: string | null,
>     type?: string | null,
>     provider?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null,
>     last_message_timestamp?: string | null,
>     unread_count?: number | null,
>     is_archived?: boolean | null,
>     is_readonly?: boolean | null,
>     is_group?: boolean | null,
>     is_1to1?: boolean | null,
>     participants_count?: number | null,
>     restrictions?: string[] | null,
>     folders?: string[] | null,
>     user?: {
>       id: string,
>       object?: string | null,
>       type?: string | null,
>       public_identifier?: string | null,
>       display_name?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       profile_url?: string | null,
>       public_picture_url?: string | null,
>       description?: string | null,
>       specifics?: {
>         location?: string | null,
>         network_distance?: string | null,
>         industry?: string | null,
>         is_following?: boolean | null,
>         followers_count?: number | null,
>         relations_count?: number | null,
>         shared_relations_count?: number | null,
>         is_premium?: boolean | null,
>         is_verified?: boolean | null
>       } | null
>     } | null,
>     participants?: {
>       id: string,
>       object?: string | null,
>       type?: string | null,
>       public_identifier?: string | null,
>       display_name?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       profile_url?: string | null,
>       public_picture_url?: string | null,
>       description?: string | null,
>       specifics?: {
>         location?: string | null,
>         network_distance?: string | null,
>         industry?: string | null,
>         is_following?: boolean | null,
>         followers_count?: number | null,
>         relations_count?: number | null,
>         shared_relations_count?: number | null,
>         is_premium?: boolean | null,
>         is_verified?: boolean | null
>       } | null
>     }[] | null,
>     last_message?: {
>     } | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        chats: {
            update: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

## Email Drafts

### Delete

`emailDrafts.delete`

An email draft was deleted

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `email.draft.delete` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   id: string
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: email.draft.delete,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     id: string
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        emailDrafts: {
            delete: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### New

`emailDrafts.new`

An email draft was created

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `email.draft.new` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   id: string,
>   thread_id?: string | null,
>   subject?: string | null,
>   snippet?: string | null
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: email.draft.new,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     id: string,
>     thread_id?: string | null,
>     subject?: string | null,
>     snippet?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        emailDrafts: {
            new: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

## Email Folders

### Create

`emailFolders.create`

An email folder or label was created

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `email.folder.create` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   id: string,
>   name?: string | null,
>   role?: string | null,
>   parent_id?: string | null
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: email.folder.create,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     id: string,
>     name?: string | null,
>     role?: string | null,
>     parent_id?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        emailFolders: {
            create: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Delete

`emailFolders.delete`

An email folder or label was deleted

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `email.folder.delete` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   id: string
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: email.folder.delete,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     id: string
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        emailFolders: {
            delete: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Update

`emailFolders.update`

An email folder or label was changed

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `email.folder.update` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   id: string,
>   name?: string | null,
>   role?: string | null,
>   parent_id?: string | null
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: email.folder.update,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     id: string,
>     name?: string | null,
>     role?: string | null,
>     parent_id?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        emailFolders: {
            update: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

## Emails

### Bounce

`emails.bounce`

A bounce notice arrived for an email the account sent (sent instead of email.new)

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `email.new.bounce` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   reason?: string | null,
>   date?: string | null,
>   addresses?: string | null,
>   type?: string | null,
>   code?: string | null,
>   email?: {
>     id: string,
>     thread_id?: string | null,
>     subject?: string | null,
>     snippet?: string | null,
>     date?: string | null,
>     is_unread?: boolean | null
>   } | null
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: email.new.bounce,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     reason?: string | null,
>     date?: string | null,
>     addresses?: string | null,
>     type?: string | null,
>     code?: string | null,
>     email?: {
>       id: string,
>       thread_id?: string | null,
>       subject?: string | null,
>       snippet?: string | null,
>       date?: string | null,
>       is_unread?: boolean | null
>     } | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        emails: {
            bounce: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Delete

`emails.delete`

An email left a folder: deleted, trashed or moved elsewhere

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `email.delete` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   folder_id: string,
>   email: {
>     id: string
>   }
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: email.delete,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     folder_id: string,
>     email: {
>       id: string
>     }
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        emails: {
            delete: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### New

`emails.new`

An email was added to a folder: received, sent, or moved in (check folder\_id). Gmail, Outlook and IMAP can report it up to 10 seconds late

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `email.new` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   folder_id: string,
>   email: {
>     id: string,
>     thread_id?: string | null,
>     subject?: string | null,
>     snippet?: string | null,
>     date?: string | null,
>     is_unread?: boolean | null
>   }
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: email.new,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     folder_id: string,
>     email: {
>       id: string,
>       thread_id?: string | null,
>       subject?: string | null,
>       snippet?: string | null,
>       date?: string | null,
>       is_unread?: boolean | null
>     }
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        emails: {
            new: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

## Followers

### New

`followers.new`

Someone started following the account owner (LinkedIn can report it up to 6 hours late)

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `follower.new` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   id: string,
>   object?: string | null,
>   type?: string | null,
>   public_identifier?: string | null,
>   display_name?: string | null,
>   first_name?: string | null,
>   last_name?: string | null,
>   profile_url?: string | null,
>   public_picture_url?: string | null,
>   description?: string | null,
>   specifics?: {
>     location?: string | null,
>     network_distance?: string | null,
>     industry?: string | null,
>     is_following?: boolean | null,
>     followers_count?: number | null,
>     relations_count?: number | null,
>     shared_relations_count?: number | null,
>     is_premium?: boolean | null,
>     is_verified?: boolean | null
>   } | null
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: follower.new,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     id: string,
>     object?: string | null,
>     type?: string | null,
>     public_identifier?: string | null,
>     display_name?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     profile_url?: string | null,
>     public_picture_url?: string | null,
>     description?: string | null,
>     specifics?: {
>       location?: string | null,
>       network_distance?: string | null,
>       industry?: string | null,
>       is_following?: boolean | null,
>       followers_count?: number | null,
>       relations_count?: number | null,
>       shared_relations_count?: number | null,
>       is_premium?: boolean | null,
>       is_verified?: boolean | null
>     } | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        followers: {
            new: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

## Messages

### Delete

`messages.delete`

A message was deleted

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `message.delete` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   chat_id: string,
>   id: string
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: message.delete,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     chat_id: string,
>     id: string
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        messages: {
            delete: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### New

`messages.new`

A message was received or sent in a chat (check payload.is\_sender)

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `message.new` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   object?: string | null,
>   id: string,
>   chat_id: string,
>   sender_id: string,
>   text?: string | null,
>   timestamp: string,
>   is_sender?: boolean | null,
>   is_seen?: boolean | null,
>   is_delivered?: boolean | null,
>   is_deleted?: boolean | null,
>   is_edited?: boolean | null,
>   is_event?: boolean | null,
>   provider?: string | null,
>   attachments?: any[] | null,
>   sender?: {
>     id: string,
>     object?: string | null,
>     type?: string | null,
>     public_identifier?: string | null,
>     display_name?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     profile_url?: string | null,
>     public_picture_url?: string | null,
>     description?: string | null,
>     specifics?: {
>       location?: string | null,
>       network_distance?: string | null,
>       industry?: string | null,
>       is_following?: boolean | null,
>       followers_count?: number | null,
>       relations_count?: number | null,
>       shared_relations_count?: number | null,
>       is_premium?: boolean | null,
>       is_verified?: boolean | null
>     } | null
>   } | null,
>   quoted?: {
>   } | null
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: message.new,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     object?: string | null,
>     id: string,
>     chat_id: string,
>     sender_id: string,
>     text?: string | null,
>     timestamp: string,
>     is_sender?: boolean | null,
>     is_seen?: boolean | null,
>     is_delivered?: boolean | null,
>     is_deleted?: boolean | null,
>     is_edited?: boolean | null,
>     is_event?: boolean | null,
>     provider?: string | null,
>     attachments?: any[] | null,
>     sender?: {
>       id: string,
>       object?: string | null,
>       type?: string | null,
>       public_identifier?: string | null,
>       display_name?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       profile_url?: string | null,
>       public_picture_url?: string | null,
>       description?: string | null,
>       specifics?: {
>         location?: string | null,
>         network_distance?: string | null,
>         industry?: string | null,
>         is_following?: boolean | null,
>         followers_count?: number | null,
>         relations_count?: number | null,
>         shared_relations_count?: number | null,
>         is_premium?: boolean | null,
>         is_verified?: boolean | null
>       } | null
>     } | null,
>     quoted?: {
>     } | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        messages: {
            new: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Reaction Delete

`messages.reactionDelete`

A reaction was removed from a message

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `message.reaction.delete` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   chat_id: string,
>   message_id: string,
>   reaction?: {
>   } | null
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: message.reaction.delete,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     chat_id: string,
>     message_id: string,
>     reaction?: {
>     } | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        messages: {
            reactionDelete: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Reaction New

`messages.reactionNew`

Someone reacted to a message

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `message.reaction.new` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   chat_id: string,
>   message_id: string,
>   reaction?: {
>   } | null
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: message.reaction.new,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     chat_id: string,
>     message_id: string,
>     reaction?: {
>     } | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        messages: {
            reactionNew: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Receipt Delivery

`messages.receiptDelivery`

A sent message was delivered to someone (can fire once per member in group chats)

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `message.receipt.delivery` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   chat_id: string,
>   message_id: string,
>   user_id: string,
>   timestamp: string
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: message.receipt.delivery,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     chat_id: string,
>     message_id: string,
>     user_id: string,
>     timestamp: string
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        messages: {
            receiptDelivery: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Receipt Read

`messages.receiptRead`

Someone read a message the account sent

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `message.receipt.read` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   chat_id: string,
>   message_id: string,
>   user_id: string,
>   timestamp: string
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: message.receipt.read,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     chat_id: string,
>     message_id: string,
>     user_id: string,
>     timestamp: string
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        messages: {
            receiptRead: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Update

`messages.update`

A message was edited

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `message.update` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   object?: string | null,
>   id: string,
>   chat_id: string,
>   sender_id: string,
>   text?: string | null,
>   timestamp: string,
>   is_sender?: boolean | null,
>   is_seen?: boolean | null,
>   is_delivered?: boolean | null,
>   is_deleted?: boolean | null,
>   is_edited?: boolean | null,
>   is_event?: boolean | null,
>   provider?: string | null,
>   attachments?: any[] | null,
>   sender?: {
>     id: string,
>     object?: string | null,
>     type?: string | null,
>     public_identifier?: string | null,
>     display_name?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     profile_url?: string | null,
>     public_picture_url?: string | null,
>     description?: string | null,
>     specifics?: {
>       location?: string | null,
>       network_distance?: string | null,
>       industry?: string | null,
>       is_following?: boolean | null,
>       followers_count?: number | null,
>       relations_count?: number | null,
>       shared_relations_count?: number | null,
>       is_premium?: boolean | null,
>       is_verified?: boolean | null
>     } | null
>   } | null,
>   quoted?: {
>   } | null
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: message.update,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     object?: string | null,
>     id: string,
>     chat_id: string,
>     sender_id: string,
>     text?: string | null,
>     timestamp: string,
>     is_sender?: boolean | null,
>     is_seen?: boolean | null,
>     is_delivered?: boolean | null,
>     is_deleted?: boolean | null,
>     is_edited?: boolean | null,
>     is_event?: boolean | null,
>     provider?: string | null,
>     attachments?: any[] | null,
>     sender?: {
>       id: string,
>       object?: string | null,
>       type?: string | null,
>       public_identifier?: string | null,
>       display_name?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       profile_url?: string | null,
>       public_picture_url?: string | null,
>       description?: string | null,
>       specifics?: {
>         location?: string | null,
>         network_distance?: string | null,
>         industry?: string | null,
>         is_following?: boolean | null,
>         followers_count?: number | null,
>         relations_count?: number | null,
>         shared_relations_count?: number | null,
>         is_premium?: boolean | null,
>         is_verified?: boolean | null
>       } | null
>     } | null,
>     quoted?: {
>     } | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        messages: {
            update: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

## Relations

### New

`relations.new`

A new 1st-degree relation, usually an accepted invitation (LinkedIn can report it up to 6 hours late)

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `relation.new` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   object?: string | null,
>   id: string,
>   created_at?: string | null,
>   user: {
>     id: string,
>     object?: string | null,
>     type?: string | null,
>     public_identifier?: string | null,
>     display_name?: string | null,
>     first_name?: string | null,
>     last_name?: string | null,
>     profile_url?: string | null,
>     public_picture_url?: string | null,
>     description?: string | null,
>     specifics?: {
>       location?: string | null,
>       network_distance?: string | null,
>       industry?: string | null,
>       is_following?: boolean | null,
>       followers_count?: number | null,
>       relations_count?: number | null,
>       shared_relations_count?: number | null,
>       is_premium?: boolean | null,
>       is_verified?: boolean | null
>     } | null
>   }
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: relation.new,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     object?: string | null,
>     id: string,
>     created_at?: string | null,
>     user: {
>       id: string,
>       object?: string | null,
>       type?: string | null,
>       public_identifier?: string | null,
>       display_name?: string | null,
>       first_name?: string | null,
>       last_name?: string | null,
>       profile_url?: string | null,
>       public_picture_url?: string | null,
>       description?: string | null,
>       specifics?: {
>         location?: string | null,
>         network_distance?: string | null,
>         industry?: string | null,
>         is_following?: boolean | null,
>         followers_count?: number | null,
>         relations_count?: number | null,
>         shared_relations_count?: number | null,
>         is_premium?: boolean | null,
>         is_verified?: boolean | null
>       } | null
>     }
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        relations: {
            new: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

## Tracking

### Click

`tracking.click`

Someone clicked a tracked link in an email

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `tracking.click` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   date: string,
>   ip?: string | null,
>   user_agent?: string | null,
>   label?: string | null,
>   url: string
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: tracking.click,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     date: string,
>     ip?: string | null,
>     user_agent?: string | null,
>     label?: string | null,
>     url: string
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        tracking: {
            click: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Open

`tracking.open`

Someone opened an email sent with open tracking

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `id` | `string` | Yes | Event ID (evt\_…); deliveries can repeat it |
| `type` | `tracking.open` | Yes | — |
| `created_at` | `string` | Yes | — |
| `account_id` | `string` | Yes | Account the event happened on (acc\_…) |
| `account_provider` | `string` | No | — |
| `account_name` | `string` | No | — |
| `account_scope_id` | `string` | No | — |
| `application_id` | `string` | No | — |
| `application_production` | `boolean` | No | — |
| `payload` | `object` | Yes | — |

> **payload full type**
>
> ```ts theme={null}
> {
>   date: string,
>   ip?: string | null,
>   user_agent?: string | null,
>   label?: string | null
> }
> ```

> **Response data full type**
>
> ```ts theme={null}
> {
>   id: string,
>   type: tracking.open,
>   created_at: string,
>   account_id: string,
>   account_provider?: string | null,
>   account_name?: string | null,
>   account_scope_id?: string | null,
>   application_id?: string | null,
>   application_production?: boolean | null,
>   payload: {
>     date: string,
>     ip?: string | null,
>     user_agent?: string | null,
>     label?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
unipile({
    webhookHooks: {
        tracking: {
            open: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***


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