Produce a short summary of all Webhooks on a Bitbucket Server instance

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( )
  String tr = """<tr>
    <td><a href='/plugins/servlet/webhooks/projects/${repo.project.key}/repos/${repo.slug}'>${}/${repo.slug}</a></td>

return "<html><body><pre><table class='aui paged-table entity-table'>${table.join('')}</table></pre></body></html>"
1 Like

Hi @fatrascal,

Thank you for the great Script suggestion. :slight_smile:

Robert Giddings,
Product Manager, ScriptRunner for Bitbucket

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.