Webhooks are a very useful feature for your hosted projects and repositories. Once configured, our platform will call your webhook with a JSON object whenever there are project and repository changes.
Under the Add a New External Notification form:
Once configured, our platform will call your webhook for all project events with the following JSON object:
{
"description": name of the artifact that has been changed (type: String, example: "Story #6"),
"url": the url of the artifact (type: String, example: "https://account.xp-dev.com/story/4"),
"eventType": how the artifact has been changed (type: Enum, one of: "created", "updated", "deleted"),
"username": the user that created this event (type: String)
}
To enable webhooks on your repository:
Under the Add a New Integration form:
Once configured, our platform will call your webhook for all repository push events with the following JSON object:
{
"repository": { // object that describes the repository
"name": name of the repository (type: String),
"type": type of the repository (type: Enum, one of: Git, Mercurial, Subversion),
"ssh_url": SSH url of the repository (type: String),
"https_url": HTTPS url of the repository (type: String),
"web_url": Url of the repository to view it with a browser (type: String)
},
"project": { // object that describes the project
"name": name of the project (type: String)
"web_url": Url of the project to view it with a browser (type: String)
}
"user": Username of the user that created the event (type: String),
"reference": the branch or tag name, will be blank for Subversion repositories (type: String),
"reference_type": Either a 'Branch' or 'Tag', omitted for Subversion repositories (type: Enum),
"commits": [{ // array of objects that describe commits in this repository event
"revision": the commit revision (type: String),
"message": commit message (type: String),
"timestamp": when the commit was created (type: ISO 8601 timestamp, eg: 2020-04-05T11:12:28.123Z),
"url": Url of the commit to view it in a browser (type: String),
"author": the commit author (type: String)
"added": a list of file paths that were added in this commit (type: Array of Strings),
"removed": a list of file paths that were removed in this commit (type: Array of Strings),
"replaced": a list of file paths that were replaced in this commit (type: Array of Strings),
"modified": a list of file paths that were modified in this commit (type: Array of Strings)
}]
}
If your repository webhook integration was configured before April 2020, then it will receive our legacy JSON object for each commit:
{
"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),
"reference": Commit branch or blank for Subversion (Type:String),
"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,
"reference":"refs/heads/master",
"repository_ssl_path":"https://xp-dev.com/git/rs-importable/",
"added":["/trunk/pyserver/something"],
"revision_web":"https://xp-dev.com/sc/change/3/271dfc9d40480d706586bd8b44bf5b6ea9062d64",
"repository":"rs-importable",
"repository_path":"https://xp-dev.com/git/rs-importable/",
"removed":["/trunk/pyserver/bootstrap/compile.py"],
"replaced":[],
"modified":["/trunk/pyserver/build.properties"]
}
PHP example:
<?php
$json = file_get_contents('php://input');
var_dump(json_decode($json));
?>
Feel free to contact us if you need any assistance.