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

# Discourse webhooks

> Discourse incoming webhooks in Corsair: the event paths to subscribe to, the payload each event carries, and the response data.

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

* `badges`
  * `granted` (`badges.granted`)
  * `revoked` (`badges.revoked`)
* `categories`
  * `created` (`categories.created`)
  * `destroyed` (`categories.destroyed`)
  * `updated` (`categories.updated`)
* `groups`
  * `created` (`groups.created`)
  * `destroyed` (`groups.destroyed`)
  * `updated` (`groups.updated`)
* `likes`
  * `liked` (`likes.liked`)
* `notifications`
  * `created` (`notifications.created`)
* `ping`
  * `ping` (`ping.ping`)
* `posts`
  * `created` (`posts.created`)
  * `destroyed` (`posts.destroyed`)
  * `edited` (`posts.edited`)
  * `recovered` (`posts.recovered`)
* `reviewables`
  * `created` (`reviewables.created`)
  * `updated` (`reviewables.updated`)
* `tags`
  * `created` (`tags.created`)
  * `destroyed` (`tags.destroyed`)
  * `updated` (`tags.updated`)
* `topics`
  * `created` (`topics.created`)
  * `destroyed` (`topics.destroyed`)
  * `edited` (`topics.edited`)
  * `recovered` (`topics.recovered`)
  * `revised` (`topics.revised`)
  * `statusUpdated` (`topics.statusUpdated`)
* `users`
  * `addedToGroup` (`users.addedToGroup`)
  * `anonymized` (`users.anonymized`)
  * `approved` (`users.approved`)
  * `confirmedEmail` (`users.confirmedEmail`)
  * `created` (`users.created`)
  * `destroyed` (`users.destroyed`)
  * `loggedIn` (`users.loggedIn`)
  * `loggedOut` (`users.loggedOut`)
  * `promoted` (`users.promoted`)
  * `suspended` (`users.suspended`)
  * `unsuspended` (`users.unsuspended`)
  * `updated` (`users.updated`)

## 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);
    // With multiTenancy, give each tenant its own URL (/api/webhook?tenantId=acme):
    // the query says whose account, secret and hooks handle the delivery.
    const query = Object.fromEntries(new URL(request.url).searchParams);
    // The raw text, not request.json(): signatures are checked over the exact bytes sent.
    const body = await request.text();
    const result = await processWebhook(corsair, headers, body, query);
    if (!result.plugin) {
        return Response.json({ success: false }, { status: 404 });
    }
    // A refusal (bad signature) carries no status and answers 400; a handler
    // that threw comes back with 500, so the sender retries it.
    const status =
        result.response?.success === false ? (result.response.statusCode ?? 400) : 200;
    return Response.json(result.response ?? { success: true }, {
        status,
        headers: result.responseHeaders,
    });
}
```

## Events

## Badges

### Granted

`badges.granted`

A user badge was granted (user\_badge\_granted).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `user_badge` | `object` | Yes | The user badge as Discourse serializes it. |

> [accordion] user\_badge full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   user_badge: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
discourse({
    webhookHooks: {
        badges: {
            granted: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Revoked

`badges.revoked`

A user badge was revoked (user\_badge\_revoked).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `user_badge` | `object` | Yes | The user badge as Discourse serializes it. |

> [accordion] user\_badge full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   user_badge: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
discourse({
    webhookHooks: {
        badges: {
            revoked: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

## Categories

### Created

`categories.created`

A category was created (category\_created).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `category` | `object` | Yes | The category as Discourse serializes it. |

> [accordion] category full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   category: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

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

***

### Destroyed

`categories.destroyed`

A category was deleted (category\_destroyed).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `category` | `object` | Yes | The category as Discourse serializes it. |

> [accordion] category full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   category: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
discourse({
    webhookHooks: {
        categories: {
            destroyed: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Updated

`categories.updated`

A category was updated (category\_updated).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `category` | `object` | Yes | The category as Discourse serializes it. |

> [accordion] category full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   category: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
discourse({
    webhookHooks: {
        categories: {
            updated: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

## Groups

### Created

`groups.created`

A group was created (group\_created).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `group` | `object` | Yes | The group as Discourse serializes it. |

> [accordion] group full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   group: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

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

***

### Destroyed

`groups.destroyed`

A group was deleted (group\_destroyed).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `group` | `object` | Yes | The group as Discourse serializes it. |

> [accordion] group full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   group: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
discourse({
    webhookHooks: {
        groups: {
            destroyed: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Updated

`groups.updated`

A group was updated (group\_updated).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `group` | `object` | Yes | The group as Discourse serializes it. |

> [accordion] group full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   group: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
discourse({
    webhookHooks: {
        groups: {
            updated: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

## Likes

### Liked

`likes.liked`

A like was liked (post\_liked).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `like` | `object` | Yes | The like as Discourse serializes it. |

> [accordion] like full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   like: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
discourse({
    webhookHooks: {
        likes: {
            liked: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

## Notifications

### Created

`notifications.created`

A notification was created (notification\_created).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `notification` | `object` | Yes | The notification as Discourse serializes it. |

> [accordion] notification full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   notification: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

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

***

## Ping

### Ping

`ping.ping`

The test delivery Discourse sends from the webhook settings page (ping).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `ping` | `string \| null` | No | — |

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

**`webhookHooks` example**

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

***

## Posts

### Created

`posts.created`

A post was created (post\_created).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `post` | `object` | Yes | The post as Discourse serializes it. |

> [accordion] post full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   post: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

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

***

### Destroyed

`posts.destroyed`

A post was deleted (post\_destroyed).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `post` | `object` | Yes | The post as Discourse serializes it. |

> [accordion] post full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   post: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
discourse({
    webhookHooks: {
        posts: {
            destroyed: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Edited

`posts.edited`

A post was edited (post\_edited).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `post` | `object` | Yes | The post as Discourse serializes it. |

> [accordion] post full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   post: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
discourse({
    webhookHooks: {
        posts: {
            edited: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Recovered

`posts.recovered`

A post was restored (post\_recovered).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `post` | `object` | Yes | The post as Discourse serializes it. |

> [accordion] post full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   post: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
discourse({
    webhookHooks: {
        posts: {
            recovered: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

## Reviewables

### Created

`reviewables.created`

A reviewable was created (reviewable\_created).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `reviewable` | `object` | Yes | The reviewable as Discourse serializes it. |

> [accordion] reviewable full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   reviewable: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

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

***

### Updated

`reviewables.updated`

A review queue item changed score or status (reviewable\_score\_updated, reviewable\_transitioned\_to).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `reviewable` | `object` | Yes | The reviewable as Discourse serializes it. |

> [accordion] reviewable full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   reviewable: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
discourse({
    webhookHooks: {
        reviewables: {
            updated: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

## Tags

### Created

`tags.created`

A tag was created (tag\_created).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `tag` | `object` | Yes | The tag as Discourse serializes it. |

> [accordion] tag full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   tag: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

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

***

### Destroyed

`tags.destroyed`

A tag was deleted (tag\_destroyed).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `tag` | `object` | Yes | The tag as Discourse serializes it. |

> [accordion] tag full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   tag: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
discourse({
    webhookHooks: {
        tags: {
            destroyed: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Updated

`tags.updated`

A tag was updated (tag\_updated).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `tag` | `object` | Yes | The tag as Discourse serializes it. |

> [accordion] tag full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   tag: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
discourse({
    webhookHooks: {
        tags: {
            updated: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

## Topics

### Created

`topics.created`

A topic was created (topic\_created).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `topic` | `object` | Yes | The topic as Discourse serializes it. |

> [accordion] topic full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   topic: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

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

***

### Destroyed

`topics.destroyed`

A topic was deleted (topic\_destroyed).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `topic` | `object` | Yes | The topic as Discourse serializes it. |

> [accordion] topic full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   topic: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
discourse({
    webhookHooks: {
        topics: {
            destroyed: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Edited

`topics.edited`

A topic was edited (topic\_edited).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `topic` | `object` | Yes | The topic as Discourse serializes it. |

> [accordion] topic full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   topic: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
discourse({
    webhookHooks: {
        topics: {
            edited: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Recovered

`topics.recovered`

A topic was restored (topic\_recovered).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `topic` | `object` | Yes | The topic as Discourse serializes it. |

> [accordion] topic full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   topic: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
discourse({
    webhookHooks: {
        topics: {
            recovered: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Revised

`topics.revised`

A topic got a new revision (topic\_revised).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `topic` | `object` | Yes | The topic as Discourse serializes it. |

> [accordion] topic full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   topic: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
discourse({
    webhookHooks: {
        topics: {
            revised: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Status Updated

`topics.statusUpdated`

A topic was closed, archived, pinned, unlisted or had another status change (`topic_<status>_status_updated`).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `topic` | `object` | Yes | The topic as Discourse serializes it. |

> [accordion] topic full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   topic: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
discourse({
    webhookHooks: {
        topics: {
            statusUpdated: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

## Users

### Added To Group

`users.addedToGroup`

A user was added to a group (user\_added\_to\_group).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `group_user` | `object` | Yes | The group user as Discourse serializes it. |

> [accordion] group\_user full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   group_user: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
discourse({
    webhookHooks: {
        users: {
            addedToGroup: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Anonymized

`users.anonymized`

A user was anonymized (user\_anonymized).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `user` | `object` | Yes | The user as Discourse serializes it. |

> [accordion] user full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   user: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
discourse({
    webhookHooks: {
        users: {
            anonymized: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Approved

`users.approved`

A user was approved (user\_approved).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `user` | `object` | Yes | The user as Discourse serializes it. |

> [accordion] user full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   user: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
discourse({
    webhookHooks: {
        users: {
            approved: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Confirmed Email

`users.confirmedEmail`

A user confirmed their email (user\_confirmed\_email).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `user` | `object` | Yes | The user as Discourse serializes it. |

> [accordion] user full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   user: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
discourse({
    webhookHooks: {
        users: {
            confirmedEmail: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Created

`users.created`

A user was created (user\_created).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `user` | `object` | Yes | The user as Discourse serializes it. |

> [accordion] user full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   user: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

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

***

### Destroyed

`users.destroyed`

A user was deleted (user\_destroyed).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `user` | `object` | Yes | The user as Discourse serializes it. |

> [accordion] user full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   user: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
discourse({
    webhookHooks: {
        users: {
            destroyed: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Logged In

`users.loggedIn`

A user signed in (user\_logged\_in).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `user` | `object` | Yes | The user as Discourse serializes it. |

> [accordion] user full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   user: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
discourse({
    webhookHooks: {
        users: {
            loggedIn: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Logged Out

`users.loggedOut`

A user signed out (user\_logged\_out).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `user` | `object` | Yes | The user as Discourse serializes it. |

> [accordion] user full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   user: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
discourse({
    webhookHooks: {
        users: {
            loggedOut: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Promoted

`users.promoted`

A user moved up a trust level (user\_promoted).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `user_promoted` | `object` | Yes | The user promoted as Discourse serializes it. |

> [accordion] user\_promoted full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   user_promoted: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
discourse({
    webhookHooks: {
        users: {
            promoted: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Suspended

`users.suspended`

A user was suspended (user\_suspended).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `user` | `object` | Yes | The user as Discourse serializes it. |

> [accordion] user full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   user: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
discourse({
    webhookHooks: {
        users: {
            suspended: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Unsuspended

`users.unsuspended`

A user was unsuspended (user\_unsuspended).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `user` | `object` | Yes | The user as Discourse serializes it. |

> [accordion] user full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   user: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
discourse({
    webhookHooks: {
        users: {
            unsuspended: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***

### Updated

`users.updated`

A user was updated (user\_updated).

**Payload**

| Name | Type | Required | Description |
| - | - | - | - |
| `user` | `object` | Yes | The user as Discourse serializes it. |

> [accordion] user full type
>
> ```ts theme={null}
> {
>   id?: number | null,
>   username?: string | null,
>   name?: string | null,
>   title?: string | null,
>   slug?: string | null,
>   topic_id?: number | null,
>   post_number?: number | null,
>   raw?: string | null,
>   created_at?: string | null,
>   updated_at?: string | null
> }
> ```

> [accordion] Response data full type
>
> ```ts theme={null}
> {
>   user: {
>     id?: number | null,
>     username?: string | null,
>     name?: string | null,
>     title?: string | null,
>     slug?: string | null,
>     topic_id?: number | null,
>     post_number?: number | null,
>     raw?: string | null,
>     created_at?: string | null,
>     updated_at?: string | null
>   }
> }
> ```

**`webhookHooks` example**

```ts theme={null}
discourse({
    webhookHooks: {
        users: {
            updated: {
                before(ctx, args) {
                    return { ctx, args };
                },
                after(ctx, response) {
                },
            },
        },
    },
})
```

***


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