Post-Receive Hooks

Last updated by Adam West on September 22, 2017 12:37

You can setup post-receive hooks which will allow you to call external URLs whenever you push (or commit in the case of SVN) to your repository.

To add a new hook, visit the Repos page and click the Settings button found on the right hand side.

Then click the Post-Receive Hooks tab:

Enter the URL where the hook will be delivered to, and if you require authenticatation, click Add HTTP authentication details:

  • Username is the username that will be used for basic auth when making the request
  • Password is the password that will be used for basic auth when making the request

Example POST Payload

{   
	"before":"cbb086f8f80a54ab5103d53d461ce8cfbe7a6935",   
	"after":"cbb086f8f80a54ab5103d53d461ce8cfbe7a6935",   
	"ref":"refs/heads/master",   
	"repository":{     
		"name":"GIT",     
		"url":"https://test.codebasehq.com/projects/test/repositories/repo.git",	
                "clone_url":"git@codebasehq.com:test/repositories/repo.git",     
		"clone_urls":{       
			"ssh":"git@codebasehq.com:test/repositories/repo.git"     
		 },     
		"public_access":false,     
		"private":true,     
		"project":{       
	            "name":"test",
		    "url":"https://test.codebasehq.com/projects/test",
                    "status":"active"
		}   
	},   
	"user":{     
		"name":"Dan Quinney",     
		"username":"danq",     
		"email":"danq@atechmedia.com"   
	},   
	"commits":[{
		"id":"479c96510d456f090f9c4f619a396dbf52bd6574",       
		"message":"indexes",
	        "author":{
			"name":"Dan W",
			"email":"dan@atechmedia.com"       
		},       
		"timestamp":"Thu, 04 Apr 2013 16:15:15 +0100",   		
                "url":"https://test.codebasehq.com/projects/test/repositories/repo.git",	
		"added":[        
			 "db/migrate/20130404151222_add_indexes_to_users.rb"       
		],       
		"removed":[],       
		"modified":[]     
	}],
	"test":true 
}