> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# Method name: onCategoryCreated(event: CreatedCategory)

# Method package: wixForumBackend

# Method menu location: wixForumBackend --> Events --> onCategoryCreated

# Method Link: https://dev.wix.com/docs/velo/apis/wix-forum-backend/events/on-category-created.md

# Method Description:

A backend event that fires when a new forum category is created.

The `onCategoryCreated()` event handler runs when a new forum category is created in your site.
 The received `CreatedCategory` object contains information about the new category that was created.

> **Notes:**
> +  If you create a category from your published site, `onCategoryCreated()` runs only when you finish defining the settings and click **Create**. If you create a category using the forum settings in the Editor, `onCategoryCreated()` will run with the default settings as soon as you click **Add New Category**. As you continue to define the category settings, `onCategoryUpdated()` will run.
>
>
> + Backend events are **not** fired when previewing your site.



# Method Code Examples:

*** Note: do not assume any prop names or enum values other than the ones in the example.

## A backend event that occurs when a new forum category is created

```javascript
// Place this code in a file named events.js
// in the Backend section of your code files.

export function wixForum_onCategoryCreated(event) {
  const categoryId = event.categoryId;
  const categoryName = event.category.name;
}

/*  Full category object:
 *  {
 *    "_id": "5f88058be9b6b100175b154d",
 *    "name": "My Category Name",
 *    "headerTitle": "My Category Header Title",
 *    "description": "This is a description of my category.",
 *    "headerType": "COLOR",
 *    "headerBackgroundColor": {
 *      "color": "#8F98E2",
 *      "opacity": 0.5
 *    },
 *    "headerTextColor": {
 *      "color": "#9E3B1B",
 *      "opacity": 1
 *    },
 *    "rank": 2,
 *    "slug": "my-category-name",
 *    "pageUrl": "/forum/my-category-name",
 *    "postCount": 0,
 *    "postViewCount": 0,
 *    "writeProtected": "false",
 *    "_createdDate": "2020-10-26T07:18:20.297Z",
 *    "_updatedDate": "2020-10-26T07:18:20.297Z"
 *  }
 */

```

## A backend event that occurs when a new forum category is created

```javascript
// Place this code in a file named events.js
// in the Backend section of your code files.

export function wixForum_onCategoryCreated(event) {
  const categoryId = event.categoryId;
  const categoryName = event.category.name;
}

/*  Full category object:
 *  {
 *    "_id": "5f88058be9b6b100175b154d",
 *    "name": "My Category Name",
 *    "headerTitle": "My Category Header Title",
 *    "description": "This is a description of my category.",
 *    "headerType": "IMAGE",
 *    "headerImage": "wix:image://v1/a27d24_3...46~mv2.jpg/_.jpg#originWidth=940&originHeight=529",
 *    "headerImageOverlayColor": {
 *      "color": "#40E0D0",
 *      "opacity": 0.1
 *    },
 *    "rank": 2,
 *    "slug": "my-category-name",
 *    "pageUrl": "/forum/my-category-name",
 *    "postCount": 0,
 *    "postViewCount": 0,
 *    "writeProtected": "true",
 *    "_createdDate": "2020-10-26T07:18:20.297Z",
 *    "_updatedDate": "2020-10-26T07:18:20.297Z"
 *  }
 */

```

---