Classic Webhooks Integration

 Please Note: Only the Account Owner and repository admins are allowed to activate integrations.

What are Webhooks?

Be sure to check out our newer option, the modular Webhooks integration. The classic Webhook integration only supports Git pushes and SVN commits, where as the modular Webhooks integration supports both of those and much more (deployments, comments, branches etc). We've also created a guide that's an introduction to Webhooks.

Webhooks allow you to customize, extend and integrate the web applications you use with anything else you can access programmatically. To web developers, Webhooks are a simple design pattern that only require the ability to make web requests and to store some extra data about users. To users, Webhooks are a way to get events and data in realtime from their web applications.

By using Webhooks on your Beanstalk repository, you can get information about each commit to your Beanstalk repository.

How to setup integration

In order to integrate Webhooks with Beanstalk, you need to enable Webhooks integration within your repository. To do this, go to your Repository, then Settings → Integration → Class Webhooks. To get started with the setup:

  1. Select the Classic Webhooks icon, then select Activate integration
  2. After choosing Activate integration, enter the Webhook URL. Beanstalk will request this URL with POST data every time you commit something, passing along information about the commit.
  3. After entering a Webhook URL, select Activate to turn on the Webhook integration for the repository.

How to use Classic Webhooks

Information about the commits is sent with JSON formatted data. On your side, you have a variety of options for parsing the post data. Check JSON homepage for a library in your favorite language.

HTTP authentication with Webhooks

You can use HTTP authentification with Webhooks, by providing the username/pass in the Webhook url, like this:

  http://myuser:mylogin@www.mydomain.com/myhook

What is included in the JSON data for SVN repositories?

The JSON formatted data sends the following data on each commit for SVN repositories:

  • Message: The comment from the commit.
  • Changed Files: The affected files.
  • Time: The time and date of the commit.
  • Author: The username of the person who made the commit.
  • Author's Full Name: The full name of the author.
  • Author's Email: Email address of the author.
  • Changeset URL: The URL to exact revision in Beanstalk's web application (not the SVN URL).
  • Revision: The revision number for this changeset.
  • Changed Directories: A list of directories that were updated.

JSON data example for SVN repository

Here is how JSON data which we send looks like:

{      
	"message": "Sample commit comment.",
	"changed_files": [
	{
	["README","edit"],
	          ["test/vimrc","edit"]
	          ],
	}          
	"time": "2008/12/25 11:54:22 +0000",
	"author": "daffy",
	"author_full_name": "John Smith",      
	"author_email": "john@beanstalkapp.com",      
	"changeset_url": "https://account.beanstalkapp.com/repo/changesets/1",      "revision": 2,      
	"changed_dirs": []
}

What is included in the JSON data for GIT repositories?

The JSON formatted data sends the following data on each commit for GIT repositories:

  • Before: hash of the last commit message before push
  • After: hash of the last commit message in the push (in case there were more than 1 commit, that would be the most recent commit before the push)
  • Push is To Large Flag: flag is set when there are more than 50 commit messages within push, in that case, commit container in JSON object would be emtpy
  • Ref: lists HEAD in the repository
  • Branch: branch on which user pushed the changes
  • URI: git reposority URL
  • Repository: contains name of the repository, and information about owner, whether repository is private, url to the account
  • Commits: contains information about commit hash (id), author of the commit, affected directories, files, url of the commit changeset, commit message, time when commit happened

JSON data example for Git repository

Here is how JSON data which we send looks like:

{
      "before": "7295fb96e74d1b54ba65cb003dce4da4193b5d29",      
      "after": "4ec8a1fcb42d278b60b33baa403a85c2e6706b5f",      "push_is_too_large": false,      
      "ref": "refs/heads/development",      
      "branch": "development",      
      "uri": "git@wildbit.beanstalkapp.com:\/beanstalk.git",      
      "repository": 
      {          
      	"name": "beanstalk",          
      	"owner": 
      	{            
      		"email": "sdmitry@gmail.com",            
      		"name": "Dima Sabanin"          
      	},          
      "private": true,          
      "url": "http://wildbit.beanstalkapp.com/beanstalk"      
  	  },      
  	  "commits": 
  	  [        
  	  {          
  	  	"id": "4ec8a1fcb42d278b60b33baa403a85c2e6706b5f",          
  	  	"author": 
  	  	{            
  	  		"email": "sdmitry@gmail.com",            
  	  		"name": "Dima Sabanin"          
  	  	},          
  	  	"changed_dirs": [],          
  	  	"changed_files": [            
  	  	[              
  	  	"db/schema.rb",              
  	  	"edit"            
  	  	] ],          
  	  	"url": "http://wildbit.beanstalkapp.com/beanstalk/changesets/4ec8a1fcb42d278b60b33baa403a85c2e6706b5f",          
  	  	"id": "4ec8a1fcb42d278b60b33baa403a85c2e6706b5f",          
  	  	"message": "Updated schema",          
  	  	timestamp": "2010-04-14T17:54:16+08:00"        
  	  },        
  	  {          
  	  	"id": "7295fb96e74d1b54ba65cb003dce4da4193b5d29",          
  	  	"author": {            
  	  	"email": "sdmitry@gmail.com",            
  	  	"name": "Dima Sabanin"          
  	  },          
  	  "changed_dirs": [],          
  	  "changed_files": [            
  	  [              
  	  "lib/hooks/git/git_adapter.rb",              
  	  "edit"            
  	  ] ],          
  	  "url": "http://wildbit.beanstalkapp.com/beanstalk/changesets/7295fb96e74d1b54ba65cb003dce4da4193b5d29",          
  	  "id": "7295fb96e74d1b54ba65cb003dce4da4193b5d29",          
  	  "message": "Fixing 'Broken pipe' error",          "timestamp": "2010-04-15T17:54:16+08:00"        
  	  }      
  	  ]  
}
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us