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

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

The Intercom plugin handles incoming webhooks. Point your provider’s subscription URL at your Corsair HTTP handler (see [Overview](https://docs.corsair.dev/plugins/intercom/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

* `contacts`
  * `created` (`contacts.created`)
  * `deleted` (`contacts.deleted`)
  * `tagCreated` (`contacts.tagCreated`)
* `conversations`
  * `assigned` (`conversations.assigned`)
  * `closed` (`conversations.closed`)
  * `created` (`conversations.created`)
* `ping` (`ping`)

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

## Contacts

### Created

`contacts.created`

A new contact was created in Intercom

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `type` | `string` | Yes | — |
| `topic` | `string` | Yes | — |
| `id` | `string \| null` | Yes | — |
| `app_id` | `string` | Yes | — |
| `created_at` | `number` | Yes | — |
| `first_sent_at` | `number` | No | — |
| `data` | `object` | Yes | — |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   type?: string,
>   item: Record<string, any>
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   id: string,
>   email?: string,
>   name?: string,
>   role?: string,
>   created_at?: number
> }
> ```

**`webhookHooks` example**

```ts theme={null}
intercom({
    webhookHooks: {
        contacts: {
            created: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Deleted

`contacts.deleted`

A contact was deleted from Intercom

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `type` | `string` | Yes | — |
| `topic` | `string` | Yes | — |
| `id` | `string \| null` | Yes | — |
| `app_id` | `string` | Yes | — |
| `created_at` | `number` | Yes | — |
| `first_sent_at` | `number` | No | — |
| `data` | `object` | Yes | — |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   type?: string,
>   item: Record<string, any>
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   id: string,
>   deleted?: boolean
> }
> ```

**`webhookHooks` example**

```ts theme={null}
intercom({
    webhookHooks: {
        contacts: {
            deleted: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Tag Created

`contacts.tagCreated`

A tag was added to a contact

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `type` | `string` | Yes | — |
| `topic` | `string` | Yes | — |
| `id` | `string \| null` | Yes | — |
| `app_id` | `string` | Yes | — |
| `created_at` | `number` | Yes | — |
| `first_sent_at` | `number` | No | — |
| `data` | `object` | Yes | — |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   type?: string,
>   item: Record<string, any>
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   id: string,
>   tag_id?: string,
>   contact_id?: string
> }
> ```

**`webhookHooks` example**

```ts theme={null}
intercom({
    webhookHooks: {
        contacts: {
            tagCreated: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

## Conversations

### Assigned

`conversations.assigned`

A conversation was assigned to an admin or team

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `type` | `string` | Yes | — |
| `topic` | `string` | Yes | — |
| `id` | `string \| null` | Yes | — |
| `app_id` | `string` | Yes | — |
| `created_at` | `number` | Yes | — |
| `first_sent_at` | `number` | No | — |
| `data` | `object` | Yes | — |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   type?: string,
>   item: Record<string, any>
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   id: string,
>   assignee?: {
>     type?: string,
>     id?: number | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
intercom({
    webhookHooks: {
        conversations: {
            assigned: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Closed

`conversations.closed`

A conversation was closed

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `type` | `string` | Yes | — |
| `topic` | `string` | Yes | — |
| `id` | `string \| null` | Yes | — |
| `app_id` | `string` | Yes | — |
| `created_at` | `number` | Yes | — |
| `first_sent_at` | `number` | No | — |
| `data` | `object` | Yes | — |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   type?: string,
>   item: Record<string, any>
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   id: string,
>   state?: string
> }
> ```

**`webhookHooks` example**

```ts theme={null}
intercom({
    webhookHooks: {
        conversations: {
            closed: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Created

`conversations.created`

A new conversation was created

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `type` | `string` | Yes | — |
| `topic` | `string` | Yes | — |
| `id` | `string \| null` | Yes | — |
| `app_id` | `string` | Yes | — |
| `created_at` | `number` | Yes | — |
| `first_sent_at` | `number` | No | — |
| `data` | `object` | Yes | — |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   type?: string,
>   item: Record<string, any>
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   id: string,
>   created_at?: number,
>   state?: string
> }
> ```

**`webhookHooks` example**

```ts theme={null}
intercom({
    webhookHooks: {
        conversations: {
            created: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

## Ping

### Ping

`ping`

Initial ping sent by Intercom when a webhook URL is first registered

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `type` | `string` | Yes | — |
| `topic` | `string` | Yes | — |
| `id` | `string \| null` | Yes | — |
| `app_id` | `string` | Yes | — |
| `created_at` | `number` | Yes | — |
| `first_sent_at` | `number` | No | — |
| `data` | `object` | Yes | — |

> [accordion] data full type
>
> ```ts theme={null}
> {
>   type?: string,
>   item: Record<string, any>
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   type: ping,
>   message: string
> }
> ```

**`webhookHooks` example**

```ts theme={null}
intercom({
    webhookHooks: {
        ping: {
            before(ctx, args) {
                return { ctx, args };
            },
            after(ctx, response) {
            },
        },
    },
})
```

***


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