XP-Dev.com Documentation - User Guide - Webhooks
Webhooks are a very useful feature for version control systems. The configured webhook will be called on each commit and contains some information about the the commit change.
The most common use of webhooks is to trigger continous-integration servers to kick off a build process.
Enabling Webhooks
To enable webhooks on your Subversion repository:
- Head over to your Source Control tab of your project
- Click on Edit Repository
- Enter a URL next to Webhook URL
- Click on Save

- The webhook will be displayed next to Webook URL under the Source Control tab of your project

- To disable the webhook, just leave the field blank
Now, whenever a new revision has been committed into the repository, XP-Dev.com will submit a JSON message to your URL in the method body.
Format
You will get a new request on the URL for each commit.
The format of the JSON message is below:
{ "repository":Name of the repository (Type:String), "message": Commit log message (Type:String), "timestamp": Timestamp of commit (Unix epoch in miliseconds) (Type:long), "author": Committer (Type:String), "revision": Commit revision (Type:long),"repository_ssl_path": Full SSL URL to the repository root (Type:String), "repository_path": Full non-SSL URL to the repository root (Type:String),"revision_web": Url to view the changeset on XP-Dev.com (Type:String),"added":List of paths that have been added (Type:String array), "removed":List of paths that have been removed/deleted (Type:String array), "replaced":List of paths that have been replaced (Type:String array), "modified":List of paths that have been modifed (Type:String array) }
An example of the JSON message is below:
{
"message":"some changes for tomorrows release",
"timestamp":1235327991226,
"author":"rs",
"revision":652,
"repository_ssl_path":"https://svn.xp-dev.com/svn/rs-importable/",
"added":["/trunk/pyserver/something"],
"revision_web":"http://xp-dev.com/svnview/changeset/3/652/",
"repository":"rs-importable",
"repository_path":"http://svn.xp-dev.com/svn/rs-importable/",
"removed":["/trunk/pyserver/bootstrap/compile.py"],
"replaced":[],
"modified":["/trunk/pyserver/build.properties"]
}
Example Code to Receive the Data
PHP example:
<?php $json = file_get_contents('php://input');var_dump(json_decode($json)); ?>
Testing Your Webhook
You can use curl to test your webhook. Head over to their download page and download the appropriate package for your platform.
Running the following command will test that your webhook is installed correctly.
Please do note that the webhook URL in the following example is set to http://example.com/webhook.php. You should change it to your own webhook URL.
curl -d '{"message":"svn:commit for logparser-1","timestamp":1223820987303,"author":"rs","revision":627,"repository_ssl_path":"https://svn.xp-dev.com/svn/rs-importable/","added":["/tags/logparser-1","/tags/logparser-1/src/python/reportgenerator.py"],"revision_web":"http://xp-dev.com/svnview/changeset/3/627/","repository":"rs-importable","repository_path":"http://svn.xp-dev.com/svn/rs-importable/","removed":[],"replaced":["/tags/logparser-1/src/sql","/tags/logparser-1/src","/tags/logparser-1/src/html","/tags/logparser-1/src/python","/tags/logparser-1/src/geoip"],"modified":[]}' http://example.com/webhook.php
If you’re using the example webhook listed above, you should get the following output:
object(stdClass)#1 (12) {
["message"]=>
string(26) "svn:commit for logparser-1"
["timestamp"]=>
float(1223820987300)
["author"]=>
string(2) "rs"
["revision"]=>
int(627)
["repository_ssl_path"]=>
string(41) "https://svn.xp-dev.com/svn/rs-importable/"
["added"]=>
array(2) {
[0]=>
string(17) "/tags/logparser-1"
[1]=>
string(47) "/tags/logparser-1/src/python/reportgenerator.py"
}
["revision_web"]=>
string(42) "http://xp-dev.com/svnview/changeset/3/627/"
["repository"]=>
string(13) "rs-importable"
["repository_path"]=>
string(40) "http://svn.xp-dev.com/svn/rs-importable/"
["removed"]=>
array(0) {
}
["replaced"]=>
array(5) {
[0]=>
string(25) "/tags/logparser-1/src/sql"
[1]=>
string(21) "/tags/logparser-1/src"
[2]=>
string(26) "/tags/logparser-1/src/html"
[3]=>
string(28) "/tags/logparser-1/src/python"
[4]=>
string(27) "/tags/logparser-1/src/geoip"
}
["modified"]=>
array(0) {
}
}
