ScriptRunner allows you to respond to Bitbucket events, via an inline script or pointer to a file. You can view the full list of events here.
You could respond to events, for example in order to:
ensure a Jira project exists for a corresponding Bitbucket project
send mail when a repository is forked
set up Continuous Integration for new repositories
Some events in Bitbucket are cancelable - you can cancel an event in order to prevent a user:
creating a project
forking a project
Find the list of cancelable events here.
Adding a Listener
Navigate to Admin → Script Event Handlers. Click a heading to add a handler. Choose Custom Listener to use your own scripts to respond to events.
Events text field, start typing to find the events you want to listen for. The event types are grouped into Cancelable and Non-cancelable categories.
Some of the built-in content will have different options, and may not ask for the events to listen for.