A Backend Events extension is a configuration file plus an event handler. You generate the files first, then spend most of your time in the handler.
This article walks through the handler for the Contact Created event. To add the extension, see Add a Backend Events Extension in Studio Two.
Follow the instructions below to:
Start from a generated extension rather than an empty folder, so the file structure and registration are already in place.
For the full procedure, see Add a Backend Events Extension in Studio Two.
You can find the new files under src/extensions/backend/events/<event-folder>/. You spend most of this article in <event-folder>.ts. For what every file in the folder is for, see Event Extension Files and Code.
<event-folder>.extension.ts is the configuration file. For an extension generated in the folder docs-event-check, it looks like this:
Leave the id that the Builder generated. source is the path to the handler, relative to src/.
<event-folder>.ts is the code Wix calls when the event occurs. The Contact Created handler that writes a log entry looks like this:
event is the event object that Wix passes to the handler. Its fields depend on the event. For the payload of each event, see its page in the API Reference.
The handler can run more than once for the same event, so keep it safe to repeat. For example, avoid creating a second record each time it runs without checking whether one exists. For how events are delivered, see Events.
To listen for a different event, change the import and the handler method. For example, swap contacts.onContactCreated for another event method from the same module or another module. The available methods are in the API Reference.
Use monitoring from @wix/essentials to write log entries. console output doesn't appear in your site's logs. See Write Log Messages in Studio Two.
When the handler does what you want, click Publish in the Studio Two editor to ship the extension with your site.
Last updated: 2 November 2026