Codebrag supports webhooks which can be used to notify external systems about all internal events.
Just define the hooks
section in your application.conf
file based on the below example.
These are the supported hooks:
-
like-hook
- occurs when a user likes a given change -
unlike-hook
- occurs if a user dislikes the previously liked change -
comment-added-hook
- occurs when a user post a comment -
commit-reviewed-hook
- occurs when a user hitReviewed
button -
all-commits-reviewed-hook
- occurs when a user hit a button and marked all commits to be reviewed as reviewed at once in current repo for current branch -
new-commits-loaded-hook
- occurs after loading by Codebrag new commits from repo -
new-user-registered-hook
- occurs on registering a new user in the system
You can define multiple listeners for every hook, just separate urls by comma
Right now Codebrag sends hooks as JSON encoded as UTF-8, below is the list of formats for each hook:
{
"commitInfo": {
"repoName": string,
"sha": string,
"message": string,
"authorName": string,
"authorEmail": string,
"committerName": string,
"committerEmail": string,
"authorDate": date,
"commitDate": date,
"parents": [string, string]
},
"likedBy": {
"name": string,
"emailLowerCase": string,
"aliases": [{
"alias": string
}]
},
"like": {
"postingTime": date,
"fileName": string,
"lineNumber": int
},
"hookName": "like-hook",
"hookDate": date
}
{
"commitInfo": {
"repoName": string,
"sha": string,
"message": string,
"authorName": string,
"authorEmail": string,
"committerName": string,
"committerEmail": string,
"authorDate": date,
"commitDate": date,
"parents": [string, string]
},
"unlikedBy": {
"name": string,
"emailLowerCase": string,
"aliases": [{
"alias": string
}]
},
"like": {
"postingTime": date,
"fileName": string,
"lineNumber": int
},
"hookName": "unlike-hook",
"hookDate": date
}
{
"commitInfo": {
"repoName": string,
"sha": string,
"message": string,
"authorName": string,
"authorEmail": string,
"committerName": string,
"committerEmail": string,
"authorDate": date,
"commitDate": date,
"parents": [string, string]
},
"commentedBy": {
"name": string,
"emailLowerCase": string,
"aliases": [{
"alias": string
}]
},
"comment": {
"message": string,
"postingTime": date,
"fileName": string,
"lineNumber": int
},
"hookName": "comment-added-hook",
"hookDate": date
}
{
"commitInfo": {
"repoName": string,
"sha": string,
"message": string,
"authorName": string,
"authorEmail": string,
"committerName": string,
"committerEmail": string,
"authorDate": date,
"commitDate": date,
"parents": [string, string]
},
"reviewedBy": {
"name": string,
"emailLowerCase": string,
"aliases": [{
"alias": string
}]
},
"hookName": "commit-reviewed-hook",
"hookDate": date
}
{
"repoName": string,
"branchName": string,
"reviewedBy": {
"name": string,
"emailLowerCase": string,
"aliases": [{
"alias": string
}]
},
"hookName": "all-commitc-reviewed-hook",
"hookDate": date
}
{
"repoName": string,
"currentSHA": string,
"newCommits": [
{
"sha": string,
"message": string,
"authorName": string,
"authorEmail": string,
"date": date
}
],
"hookName": "new-commits-loaded-hook",
"hookDate": date
}