Git Webhook

Git Webhook is a feature to HTTP POST to the specified URL (server) when local repository is pushed to the Backlog's Git repository.

Git Webhook

For example, Webhook can be used for the following purposes:

  • to trigger CI build
  • to update backup
  • to apply the newest version to staging area
  • to connect other external systems

These can be done by using CI server's polling or cron features, which will access Git repository regularly. In contrast with polling, which access the repository periodically and could cause the time lag between operation and push, Webhook will HTTP POST right after the push. Therefore the operation can be done immediately without any time lag.

Setting Webhook

Webhook can be set for each repository.
Please refer the following pages to specify the URL to POST:

Note

Please make sure that the specified URL for Webhook is accessible from Backlog server. URL for the servers, such as the ones located in the intranet, that cannot be accessed from Backlog cannot be chosen. Similarly, private network IP addresses, such as "192.168.x.x", cannot be specified.

To fix the temporal Webhook receiver server's error (when you get HTTP status code 5xx after POST), please try again several times.

Information, such as commit and email address, will be sent as described below. To protect these information, please specify the HTTPS URL.

Data format

With Webhook, pushing data triggers to send to the information to specified URL in JSON format. “payload” is the only parameter of JSON data as shown below:

{
  "before": commit before push,
  "after": commit after push,
  "ref": reference
  "repository": {
    "url": URL of repository,
    "name": name of repository,
    "description": repository description,
  },
  "revisions": [{
    "id": commit's ID,
    "url": commit'sURL,
    "author": {
      "email": email address of the person who committed,
      "name": name of the person who committed
    },
    "message": commit message,
    "timestamp": time stamp,
    "added": [ added file ],
    "removed": [ deleted file],
    "modified": [ modified file ],
  }]
}

Sample data:

{
  "before": "5aef35982fb2d34e9d9d4502f6ede1072793222d",
  "after": "c0b8abaa6df37ea682454c25f2d602dffb5de6ed",
  "ref": "refs/heads/master"
  "repository": {
    "url": "https://demo.backlog.com/git/DORA/himitsu",
    "name": "himitsu",
    "description": "Repository about secret tools",
  },
  "revisions": [
    {
      "id": "8e82fe274af30adbb378785628db509da1c969d1",
      "url": "https://demo.backlog.com/git/DORA/himitsu/commit/8e82fe274af30adbb378785628db509da1c969d1",
      "author": {
        "email": "nobi@example.com",
        "name": "nobi"
      },
      "message": "Created a door to take you anywhere",
      "timestamp": "2013-04-01T14:57:17+09:00",
      "added": ["html/anywhere.html", "css/anywhere.css"]
    },
    {
      "id": "c0b8abaa6df37ea682454c25f2d602dffb5de6ed",
      "url": "https://demo.backlog.com/git/DORA/himitsu/commit/c0b8abaa6df37ea682454c25f2d602dffb5de6ed",
      "author": {
        "email": "gouda@example.com",
        "name": "gouda"
      },
      "message": "DORA-1 Bamboo helicopter is broken #fixed",
      "timestamp": "2013-04-01T18:22:10+09:00",
      "removed": ["html/take-copter.html"]
    },
  ],
}