Modular webhooks, JSON examples

Commit (SVN)

{
  "trigger": "commit",
  "payload": {
    "type": "SubversionCommit",
    "id": 42,
    "message": "Commit message.",
    "branch": null,
    "author": {
      "name": "user",
      "email": "user@example.org"
    },
    "beanstalk_user": {
      "type": "Owner",
      "id": 42,
      "login": "username",
      "email": "user@example.org",
      "name": "Name Surname"
    },
    "repository": {
      "id": 42,
      "name": "repository-name",
      "title": "Repository Title",
      "type": "SubversionRepository"
    },
    "changed_files": {
      "added": [
        "trunk/USAGE.md"
      ],
      "deleted": [],
      "modified": [
        "trunk/README"
      ],
      "copied": []
    },
    "changed_dirs": {
      "added": [
        "trunk/test"
      ],
      "deleted": [],
      "modified": [],
      "copied": []
    },
    "changeset_url": "https://subdomain.beanstalkapp.com/repository-name/changesets/42",
    "committed_at": "2014/08/18 14:36:42 +0000"
  }
}

Push (Git)

{
  "trigger": "push",
  "payload": {
    "type": "GitPush",
    "before": "xxxxxxxx",
    "after": "yyyyyyyy",
    "branch": "branch-name",
    "ref": "refs/heads/branch-name",
    "repository": {
      "id": 42,
      "name": "repo",
      "title": "repo",
      "type": "GitRepository"
    },
    "beanstalk_user": {
      "type": "Owner",
      "id": 42,
      "login": "username",
      "email": "user@example.org",
      "name": "Name Surname"
    },
    "commits": [
      {
        "type": "GitCommit",
        "id": "ffffffff",
        "message": "Important changes.",
        "branch": "branch-name",
        "author": {
          "name": "Name Surname",
          "email": "user@example.org"
        },
        "beanstalk_user": {
          "type": "Owner",
          "id": 42,
          "login": "username",
          "email": "user@example.org",
          "name": "Name Surname"
        },
        "changed_files": {
          "added": [
            "NEWFILE"
          ],
          "deleted": [
            "Gemfile"
          ],
          "modified": [
            "README.md"
          ],
          "copied": [
          ]
        },
        "changeset_url": "https://subdomain.beanstalkapp.com/repository-name/changesets/ffffffff",
        "committed_at": "2014/08/18 13:30:29 +0000",
        "parents": [
          "afafafaf"
        ]
      }
    ]
  }
}

Comment (SVN)

{
  "trigger": "comment",
  "payload": {
    "type": "Comment",
    "id": 42,
    "repository": {
      "id": 42,
      "name": "repository-name",
      "title": "Repository Title",
      "type": "SubversionRepository"
    },
    "author": {
      "type": "Owner",
      "id": 42,
      "login": "username",
      "email": "user@example.org",
      "name": "Name Surname"
    },
    "origin": {
      "type": "Changeset",
      "revision": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
      "file_path": null,
      "line_num_left": null,
      "line_num_right": null
    },
    "body": "Comment text.",
    "rendered_body": "<p>Comment text.</p>\n",
    "created_at": "2014/08/18 20:22:17 +0000"
  }
}

Comment (Git)

{
  "trigger": "comment",
  "payload": {
    "type": "Comment",
    "id": 42,
    "repository": {
      "id": 42,
      "name": "repository-name",
      "title": "Repository Title",
      "type": "GitRepository"
    },
    "author": {
      "type": "Owner",
      "id": 42,
      "login": "username",
      "email": "user@example.org",
      "name": "Name Surname"
    },
    "origin": {
      "type": "Changeset",
      "revision": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
      "file_path": null,
      "line_num_left": null,
      "line_num_right": null
    },
    "body": "Comment text.",
    "rendered_body": "<p>Comment text.</p>\n",
    "created_at": "2014/08/18 21:26:54 +0000"
  }
}

deploy (SVN)

{
  "trigger": "deploy",
  "payload": {
    "type": "Deployment",
    "id": 42,
    "state": "failed",
    "deployed_at": null,
    "comment": "Deployment description.",
    "deploy_from_scratch": false,
    "retries": 0,
    "revision": "42",
    "user": {
      "type": "Owner",
      "id": 42,
      "login": "username",
      "email": "user@example.org",
      "name": "Name Surname"
    },
    "environment": {
      "type": "DeploymentEnvironment",
      "id": 42,
      "name": "env",
      "automatic": false,
      "servers": [
        {
          "type": "Server",
          "id": 42,
          "name": "Server Name",
          "protocol": "heroku",
          "remote_path": "/",
          "repository_path": "/trunk"
        }
      ]
    },
    "repository": {
      "id": 42,
      "name": "repository-name",
      "title": "Repository Title",
      "type": "SubversionRepository"
    }
  }
}

deploy (Git)

{
  "trigger": "deploy",
  "payload": {
    "type": "Deployment",
    "id": 42,
    "state": "success",
    "deployed_at": "2014/08/18 23:54:43 +0000",
    "comment": "Deployment description.",
    "deploy_from_scratch": false,
    "retries": 0,
    "revision": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "user": {
      "type": "Owner",
      "id": 42,
      "login": "username",
      "email": "user@example.org",
      "name": "Name Surname"
    },
    "environment": {
      "type": "DeploymentEnvironment",
      "id": 42,
      "name": "prod",
      "branch": "master",
      "automatic": false,
      "servers": [
        {
          "type": "Server",
          "id": 42,
          "name": "server-name",
          "protocol": "shell",
          "remote_path": "~/",
          "repository_path": "/"
        }
      ]
    },
    "repository": {
      "id": 42,
      "name": "repository-name",
      "title": "Repository Title",
      "type": "GitRepository"
    }
  }
}

create_branch (SVN)

{
  "trigger": "create_branch",
  "payload": {
    "type": "SubversionBranch",
    "repository": {
      "id": 931,
      "name": "repository-name",
      "title": "Repository Name",
      "type": "SubversionRepository"
    },
    "path": "branches/branch-name/",
    "name": "branch-name"
  }
}

create_branch (Git)

{
  "trigger": "create_branch",
  "payload": {
    "type": "GitBranch",
    "repository": {
      "id": 42,
      "name": "repository-name",
      "title": "Repository Name",
      "type": "GitRepository"
    },
    "path": "refs/heads/branch-name",
    "name": "branch-name"
  }
}

delete_branch (SVN)

{
  "trigger": "delete_branch",
  "payload": {
    "type": "SubversionBranch",
    "repository": {
      "id": 42,
      "name": "repository-name",
      "title": "Repository Title",
      "type": "SubversionRepository"
    },
    "path": "branches/branch-name/",
    "name": "branch-name"
  }
}

delete_branch (Git)

{
  "trigger": "delete_branch",
  "payload": {
    "type": "GitBranch",
    "repository": {
      "id": 42,
      "name": "repository-name",
      "title": "Repository Title",
      "type": "GitRepository"
    },
    "path": "refs/heads/feature",
    "name": "feature"
  }
}

create_tag (SVN)

{
  "trigger": "create_tag",
  "payload": {
    "type": "SubversionTag",
    "repository": {
      "id": 931,
      "name": "repository-name",
      "title": "Repository Name",
      "type": "SubversionRepository"
    },
    "path": "tags/tag-name/",
    "name": "tag-name"
  }
}

create_tag (Git)

{
  "trigger": "create_tag",
  "payload": {
    "type": "GitTag",
    "repository": {
      "id": 42,
      "name": "repository-name",
      "title": "Repository Name",
      "type": "GitRepository"
    },
    "path": "refs/tags/tag-name",
    "name": "tag-name"
  }
}

delete_tag (SVN)

{
  "trigger": "delete_tag",
  "payload": {
    "type": "SubversionTag",
    "repository": {
      "id": 42,
      "name": "repository-name",
      "title": "Repository Title",
      "type": "SubversionRepository"
    },
    "path": "tags/tag-name",
    "name": "tag-name"
  }
}

delete_tag (Git)

{
  "trigger": "delete_tag",
  "payload": {
    "type": "GitTag",
    "repository": {
      "id": 42,
      "name": "repository-name",
      "title": "Repository Title",
      "type": "GitRepository"
    },
    "path": "refs/tags/tag-name",
    "name": "tag-name"
  }
}

request_code_review (Git)

{
  "trigger": "request_code_review",
  "payload": {
    "type": "CodeReviewEvent",
    "id": 925,
    "event": "create",
    "created_at": "2015-01-13 15:28:39 UTC",
    "user": {
      "type": "Owner",
      "id": 1,
      "login": "ilya",
      "email": "ilya@example.com",
      "name": "Ilya Sabanin"
    },
    "repository": {
      "id": 12,
      "name": "git-repo",
      "title": "Awesome Git Repo",
      "type": "GitRepository"
    },
    "code_review": {
      "type": "CodeReview",
      "id": 14,
      "source_branch": "master",
      "target_branch": "fix-all-the-things",
      "description": "Awesome branch that fixes everything",
      "state": "new"
    }
  }
}

request_code_review (SVN)

{
  "trigger": "request_code_review",
  "payload": {
    "type": "CodeReviewEvent",
    "id": 925,
    "event": "create",
    "created_at": "2015-01-13 15:28:39 UTC",
    "user": {
      "type": "Owner",
      "id": 1,
      "login": "ilya",
      "email": "ilya@example.com",
      "name": "Ilya Sabanin"
    },
    "repository": {
      "id": 12,
      "name": "svn-repo",
      "title": "Awesome SVN repo",
      "type": "SubversionRepository"
    },
    "code_review": {
      "type": "CodeReview",
      "id": 14,
      "source_branch": "trunk",
      "target_branch": "branches/fix-all-the-things",
      "description": "Awesome branch that fixes everything",
      "state": "new"
    }
  }
}

cancel_code_review (Git)

{
  "trigger": "cancel_code_review",
  "payload": {
    "type": "CodeReviewEvent",
    "id": 930,
    "event": "cancel",
    "created_at": "2015-01-13 15:47:05 UTC",
    "user": {
      "type": "Owner",
      "id": 1,
      "login": "ilya",
      "email": "ilya@example.com",
      "name": "Ilya Sabanin"
    },
    "repository": {
      "id": 15,
      "name": "git-repo",
      "title": "git-repo",
      "type": "GitRepository"
    },
    "code_review": {
      "type": "CodeReview",
      "id": 15,
      "source_branch": "master",
      "target_branch": "branch-1",
      "description": "test",
      "state": "cancelled"
    }
  }
}

cancel_code_review (SVN)

{
  "trigger": "cancel_code_review",
  "payload": {
    "type": "CodeReviewEvent",
    "id": 930,
    "event": "cancel",
    "created_at": "2015-01-13 15:47:05 UTC",
    "user": {
      "type": "Owner",
      "id": 1,
      "login": "ilya",
      "email": "ilya@example.com",
      "name": "Ilya Sabanin"
    },
    "repository": {
      "id": 15,
      "name": "svn-repo",
      "title": "svn-repo",
      "type": "SubversionRepository"
    },
    "code_review": {
      "type": "CodeReview",
      "id": 15,
      "source_branch": "trunk",
      "target_branch": "branches/branch-1",
      "description": "test",
      "state": "cancelled"
    }
  }
}

reopen_code_review (Git)

{
  "trigger": "reopen_code_review",
  "payload": {
    "type": "CodeReviewEvent",
    "id": 929,
    "event": "reopen",
    "created_at": "2015-01-13 15:47:04 UTC",
    "user": {
      "type": "Owner",
      "id": 1,
      "login": "ilya",
      "email": "ilya@example.com",
      "name": "Ilya Sabanin"
    },
    "repository": {
      "id": 15,
      "name": "git-repo",
      "title": "git-repo",
      "type": "GitRepository"
    },
    "code_review": {
      "type": "CodeReview",
      "id": 15,
      "source_branch": "master",
      "target_branch": "branch-1",
      "description": "test",
      "state": "cancelled"
    }
  }
}

reopen_code_review (SVN)

{
  "trigger": "reopen_code_review",
  "payload": {
    "type": "CodeReviewEvent",
    "id": 929,
    "event": "reopen",
    "created_at": "2015-01-13 15:47:04 UTC",
    "user": {
      "type": "Owner",
      "id": 1,
      "login": "ilya",
      "email": "ilya@example.com",
      "name": "Ilya Sabanin"
    },
    "repository": {
      "id": 15,
      "name": "svn-repo",
      "title": "svn-repo",
      "type": "SubversionRepository"
    },
    "code_review": {
      "type": "CodeReview",
      "id": 15,
      "source_branch": "trunk",
      "target_branch": "branches/branch-1",
      "description": "test",
      "state": "cancelled"
    }
  }
}

approve_code_review (Git)

{
  "trigger": "approve_code_review",
  "payload": {
    "type": "CodeReviewEvent",
    "id": 928,
    "event": "approve",
    "created_at": "2015-01-13 15:44:13 UTC",
    "user": {
      "type": "Owner",
      "id": 1,
      "login": "ilya",
      "email": "ilya@example.com",
      "name": "Ilya Sabanin"
    },
    "repository": {
      "id": 15,
      "name": "git-repo",
      "title": "git-repo",
      "type": "GitRepository"
    },
    "code_review": {
      "type": "CodeReview",
      "id": 15,
      "source_branch": "master",
      "target_branch": "branch-1",
      "description": "test",
      "state": "approved"
    }
  }
}

approve_code_review (SVN)

{
  "trigger": "approve_code_review",
  "payload": {
    "type": "CodeReviewEvent",
    "id": 928,
    "event": "approve",
    "created_at": "2015-01-13 15:44:13 UTC",
    "user": {
      "type": "Owner",
      "id": 1,
      "login": "ilya",
      "email": "ilya@example.com",
      "name": "Ilya Sabanin"
    },
    "repository": {
      "id": 15,
      "name": "svn-repo",
      "title": "svn-repo",
      "type": "SubversionRepository"
    },
    "code_review": {
      "type": "CodeReview",
      "id": 15,
      "source_branch": "trunk",
      "target_branch": "branches/branch-1",
      "description": "test",
      "state": "approved"
    }
  }
}
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