# Event Handlers

The Event Handler integration provides a way to execute scripts when defined events are fired.

Steps required to activate this integration include the following:

1. Enable the *Spe.Events.config* or apply your own patch with the required events enabled.
2. Add a new integration point library to your new or existing module.
3. Add a new script to the appropriate event library.
4. Configure an **Enable Rule** if needed.
5. Profit!

## Enable Configuration

While SPE comes with an example configuration, which is disabled by default, it contains several events that may not meet your requirements.

An event configuration patch may look like the following:

```xml
<configuration xmlns:patch="https://www.sitecore.net/xmlconfig/">
  <sitecore>
    <events>
      <event name="item:added">
        <handler type="Spe.Integrations.Tasks.ScriptedItemEventHandler, Spe" method="OnEvent" />
      </event>
    </events>
  </sitecore>
</configuration>
```

## Add Event Script

To mimic the event *item:added* you should create nested script libraries such as *Event Handlers -> Item -> Added* followed by a script.

![Item Added Event Handler](/files/-LA37_XwMI-w0qKeJSRe)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.sitecorepowershell.com/modules/integration-points/event-handlers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
