I find myself using Webhooks (Manage webhooks | Bitbucket Data Center and Server 8.3 | Atlassian Documentation) across a lot of repositories but have no real way of keeping track of these without clicking through individual repository configurations or looking through the system event logs.
The following script can be executed in the Scriptrunner Console and provides a short summary of all Webhooks on all repositories.
import com.atlassian.webhooks.WebhookSearchRequest;
import com.atlassian.webhooks.WebhookService;
import com.atlassian.bitbucket.repository.RepositoryService
import com.onresolve.scriptrunner.runner.ScriptRunnerImpl
def repoService = ScriptRunnerImpl.getOsgiService(RepositoryService)
def webhooks = ScriptRunnerImpl.getOsgiService(WebhookService).search( new WebhookSearchRequest.Builder().build() )
def table = ["<tr> <th>Repository</th> <th>Events</th> <th>URL</th> </tr>"]
for (webhook in webhooks) {
def repo = repoService.getById( webhook.scope.id.value.toInteger() )
String tr = """<tr>
<td><a href='/plugins/servlet/webhooks/projects/${repo.project.key}/repos/${repo.slug}'>${repo.project.name}/${repo.slug}</a></td>
<td>${webhook.events}</td>
<td>${webhook.url}</td>
</tr>"""
table.add(tr)
}
return "<html><body><pre><table class='aui paged-table entity-table'>${table.join('')}</table></pre></body></html>"