> 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`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt ## Resource: Add Event Extensions ## Article: Add Event Extensions with the Wix CLI ## Article Link: https://dev.wix.com/docs/wix-cli/guides/extensions/backend-extensions/events/add-event-extensions.md ## Article Content: # Add Event Extensions with the Wix CLI Events are triggered when specific conditions occur in your project. For app projects, these are conditions on a Wix user's site. For headless projects, they're conditions on your project's site. Your project can respond to these events using event extensions. Events in the Wix CLI are built on JavaScript SDK webhooks, and event extensions subscribe your project to these webhooks behind the scenes. Learn more [about event extensions](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/events/about-event-extensions.md). > **Note:** Event extensions are built on [webhooks](https://dev.wix.com/docs/build-apps/develop-your-app/api-integrations/events-and-webhooks/about-webhooks.md), and changes to events automatically create a new minor app version. Learn more about [webhooks and versioning](https://dev.wix.com/docs/build-apps/develop-your-app/api-integrations/events-and-webhooks/about-webhooks.md#webhooks-and-versioning). Follow the instructions below to: 1. Create an event extension for your project. 2. Test the event extension in your project. 3. Deploy your project with the event extension. Once this task is complete, your project will have an event extension that's triggered when a specific event occurs.
**Important:** You can't have 2 event extensions listening to the same event in your app. Each event can only have one handler. This includes extensions added to your app in the [app dashboard](https://manage.wix.com/account/custom-apps), not only those in the local files for your project.
## Step 1 | Create the extension In the terminal: 1. Navigate to your project repo. 2. Run the [generate](https://dev.wix.com/docs/wix-cli/command-reference/project-commands/generate.md) command. 3. The CLI will display a menu of extensions to generate. Select **Event** and hit enter to continue. 4. The CLI will prompt you to name your event folder. This is the name of the folder in the project directory that contains the event code, and the name of the event. Only you will see this name. Upon completion, the extension files will be created in your project directory with the following structure: ```bash src/ └── extensions/ └── backend/ └── events/ └── / ├── .extension.ts └── .ts ``` > **Note:** This is the default folder structure created by the CLI. You can move these files to any location within the `src/` folder and update the references in your `extension.ts` file. Learn more about the [flexible file system](https://dev.wix.com/docs/wix-cli/guides/get-started/project-structure.md#your-custom-extension-folder). Learn more about [event extension files and code](https://dev.wix.com/docs/wix-cli/guides/extensions/backend-extensions/events/event-extension-files-and-code.md). > **For app projects**: You may need to [configure permissions for your app](https://dev.wix.com/docs/build-apps/develop-your-app/access/authorization/configure-permissions-for-your-app.md) to receive the event. ## Step 2 | Test your event extension To test your event extension you must: 1. [Release a version](https://dev.wix.com/docs/wix-cli/command-reference/project-commands/release.md) with your changes. 2. Take an action that will trigger your event. ## Build and deploy your project Once your project is ready for production, you can [build and deploy](https://dev.wix.com/docs/wix-cli/guides/development/build-and-deploy-a-project.md) it. >**Note:** > When you release an app project, you release a new version of the app allowing you to publish the app to the [Wix App Market](https://www.wix.com/app-market) or install it on a site with a direct install URL. You can view [your app's versions](https://manage.wix.com/app-selector?title=Select+an+App&primaryButtonText=Select+Site&actionUrl=https%3A%2F%2Fdev.wix.com%2Fapps%2F%7BappId%7D%2Fversions-app) in the app dashboard. ## Delete an event extension To delete an event extension from your project: 1. Delete the folder that contains your event extension's files. 2. Remove the import and `.use()` statements for the extension from the [`extensions.ts`](https://dev.wix.com/docs/wix-cli/guides/extensions/about-the-extensions-ts-file.md) file.
**For app projects:** If you already have a version of your app project, you must build and deploy the project again after removing the event extension files.
## See also - [Event Extension Files and Code](https://dev.wix.com/docs/wix-cli/guides/extensions/backend-extensions/events/event-extension-files-and-code.md) - [About Events](https://dev.wix.com/docs/build-apps/develop-your-app/api-integrations/events-and-webhooks/about-events.md) - [About Event Extensions](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/events/about-event-extensions.md)