Rejoice! Kiln administrators can add web hooks as useful integration points between Kiln and any number of other services.

Built-in Web Hooks

Here’s a list of pre-built web hooks you can use under the Kiln user menu > Kiln Administration > Web Hooks:

When you go to your Web Hooks configuration screen, you’ll see that, in addition to classic web hooks (which we’ve called “A custom hook”), you can simply select the service you’d like to target with your web hook, and Kiln will tell you exactly what you need to set up the hook.

In all cases, we’ve tried to make it as easy to configure as possible. For example, if you want HipChat or Campfire integration, we’ll actually provide you a drop-down of what rooms you can submit to automatically.

We likewise provide a list of your build configurations when you’re integrating with TeamCity. We’ve tried to make it as easy as possible to set up. Just pick your service, then follow the simple instructions to connect Kiln.

Now, what exactly do these integration hooks do by default?

Chat & IM

Kiln can post updates on what’s going on with your source code right into your chat environment, making it really easy to keep your support staff up-to-date on what you’re up to.

Kiln in HipChat

Kiln will only post the first few changesets, so no worries about getting completely crushed in your chat room with a 2000-changeset push.

Build & CI

The TeamCity integration allows you to tell TeamCity when to build based on when you push. No more constant polling your Kiln installation; Kiln will simply tell TeamCity when there’s stuff to get built. Like all web hooks, you can tie TeamCity to any arbitrary collection of repositories, so having a product that’s built from several different repositories shouldn’t be an issue.

Project Management

Finally, one of the common questions we get is, “Can I use Kiln without FogBugz?” The answer has always been “yes,” but a lot of people are really asking, “Can I integrate Kiln with other bug trackers?” As of now, the answer is yes: Kiln now directly supports Pivotal Tracker.

Use other bug trackers, like Pivotal

Just tell Kiln your Pivotal API token, then use your normal Pivotal commit syntax (e.g., [Delivers #123] will automatically mark story #123 as delivered), and Kiln will add links to your changesets to the relevant stories.

Cloud Application Hosting

Kiln now offers simple deployment to AppHarbor and Windows Azure!

For AppHarbor, you’ll want to use the Build URL provided for your app (see bottom of the menu):

Screen Shot 2013-07-30 at 12.26.40 PM

 

To set up Azure integration, you’ll need to set up local Git publishing. Azure will then provide you with a deployment username and password (in addition to your repository URL), which you can enter on the web hook form.

These are just the first few baked-in web hooks we’re providing. We’d love to hear about any others you’d like us to add, so please let us know what else you’d like Kiln to integrate with.

 

Custom Web Hooks

To configure a custom web hook, just choose the URL Kiln should hit and which repositories should fire the hook. Then, every time these repositories receive a push, information about the push and its changesets will be POST’ed to the URL.

The data POST’ed is a JSON payload, and the data is accessible via the “payload” POST variable. So if you’re in .NET land, you’d access the JSON payload like so:

string s =Request["payload"];

…and string s will contain a JSON string of the following format:

{
  "commits":[
    {
      "author":"Ben Kamens <ben@fogcreek.com>", 
      "branch":"default", 
      "id":"16265aef917cfe137e250c4f71a4a77ff4ad0974", 
      "message":"This thing is taking forever", 
      "revision":14, 
      "timestamp":"3\/23\/2010 3:42:42 PM", 
      "url":"http:\/\/kamens.kilnhg.com\/Repo\/Personal\/Playground\/DNForever\/History\/16265aef917cfe137e250c4f71a4a77ff4ad0974",
      "tags":[
        "tip"
      ]
    }, 
    {
      "author":"Ben Kamens <ben@fogcreek.com>", 
      "branch":"default", 
      "id":"a077d19afed224dc7c46dc535d5f7e90546ed5bd", 
      "message":"This version is now shippable", 
      "revision":15, 
      "timestamp":"3\/23\/2010 3:42:46 PM", 
      "url":"http:\/\/kamens.kilnhg.com\/Repo\/Personal\/Playground\/DNForever\/History\/a077d19afed224dc7c46dc535d5f7e90546ed5bd",
      "tags":[]
    }
  ], 
  "pusher":{
    "email":"ben@fogcreek.com",
    "fullName":"Ben Kamens"
  },
  "repository":{
    "central":true,
    "description":"Picking up where the others left off", 
    "id":1,
    "name":"DNForever", 
    "url":"http:\/\/kamens.kilnhg.com\/Repo\/Personal\/Playground\/DNForever"
  }}

…which you can then parse and use however necessary in your continuous integration server or any piece of software that needs to know when Kiln receives a push.

The repository.id key is the repository’s ixRepo, suitable for sending to the Kiln API.

Note that the timestamp for commits are in UTC.

Please keep in mind that this data will be sent regardless of your Kiln repository’s permissions settings.

 

Testing Web Hooks

Here’s a quick and easy way to test whether or not your web hooks are firing:

  1. Go to http://requestb.in/ (or the login-based https://www.runscope.com/)
  2. Click “Make a requestbin” to create a requestbin for yourself
  3. Create a new Web Hook in Kiln that points to your postbin URL.
  4. Push some code to one of your Kiln repositories. Note that data about this push will be publicly available, so do not push anything sensitive.
  5. If everything worked properly, your postbin URL will now display all of the data sent from Kiln to postbin.org by the Web Hook, and it should look very similar to the example web hook data above.