githubのwebhookで本番へのリリース情報をchatツールに連携する


github-flowで開発をしていて、
プルリクエストがmasterブランチにマージされた時に、デプロイが走るようになっているんですが、
他の開発者やCSの方へ、今からリリースされる変更の情報を自動で連携したいと思ったので調べてみました。


## 使うもの
■github webhook
Pull Request Event

■bot
chat toolがchatworkなので、今回はchabot（※もうメンテナンスされていないのかな。。？）を使いました。

## 全体の流れ
・開発者がブランチを切ってWIP開発、プルリクエストをmasterへマージ
・chabotがPull Request Eventを受け取り、チャットワークへ連携

## hookするイベント
Pull Request EventはPull Requestが「open」と「close」で飛んできます。

```json
{
  "action": "closed",
  "number": 3,
  "pull_request": {
    "url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/pulls/3",
    "id": id,
    "html_url": "https://github.com/COMITTER_NAME/REPOSITRY_NAME/pull/3",
    "diff_url": "https://github.com/COMITTER_NAME/REPOSITRY_NAME/pull/3.diff",
    "patch_url": "https://github.com/COMITTER_NAME/REPOSITRY_NAME/pull/3.patch",
    "issue_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/issues/3",
    "number": 3,
    "state": "closed",
    "locked": false,
    "title": "dev-hogeをマージしてみる",
    "user": {
      "login": "COMITTER_NAME",
      "id": COMITTER_ID,
      "avatar_url": "https://avatars.githubusercontent.com/u/COMITTER_ID?v=3",
      "gravatar_id": "",
      "url": "https://api.github.com/users/COMITTER_NAME",
      "html_url": "https://github.com/COMITTER_NAME",
      "followers_url": "https://api.github.com/users/COMITTER_NAME/followers",
      "following_url": "https://api.github.com/users/COMITTER_NAME/following{/other_user}",
      "gists_url": "https://api.github.com/users/COMITTER_NAME/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/COMITTER_NAME/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/COMITTER_NAME/subscriptions",
      "organizations_url": "https://api.github.com/users/COMITTER_NAME/orgs",
      "repos_url": "https://api.github.com/users/COMITTER_NAME/repos",
      "events_url": "https://api.github.com/users/COMITTER_NAME/events{/privacy}",
      "received_events_url": "https://api.github.com/users/COMITTER_NAME/received_events",
      "type": "User",
      "site_admin": false
    },
    "body": "body",
    "created_at": "2016-02-17T05:29:28Z",
    "updated_at": "2016-02-17T05:29:37Z",
    "closed_at": "2016-02-17T05:29:37Z",
    "merged_at": "2016-02-17T05:29:37Z",
    "merge_commit_sha": "",
    "assignee": null,
    "milestone": null,
    "commits_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/pulls/3/commits",
    "review_comments_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/pulls/3/comments",
    "review_comment_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/pulls/comments{/number}",
    "comments_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/issues/3/comments",
    "statuses_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/statuses/01867079073bc1ba1e342af7ace7567047d9911e",
    "head": {
      "label": "COMITTER_NAME:dev-hoge",
      "ref": "dev-hoge",
      "sha": "01867079073bc1ba1e342af7ace7567047d9911e",
      "user": {
        "login": "COMITTER_NAME",
        "id": COMITTER_ID,
        "avatar_url": "https://avatars.githubusercontent.com/u/COMITTER_ID?v=3",
        "gravatar_id": "",
        "url": "https://api.github.com/users/COMITTER_NAME",
        "html_url": "https://github.com/COMITTER_NAME",
        "followers_url": "https://api.github.com/users/COMITTER_NAME/followers",
        "following_url": "https://api.github.com/users/COMITTER_NAME/following{/other_user}",
        "gists_url": "https://api.github.com/users/COMITTER_NAME/gists{/gist_id}",
        "starred_url": "https://api.github.com/users/COMITTER_NAME/starred{/owner}{/repo}",
        "subscriptions_url": "https://api.github.com/users/COMITTER_NAME/subscriptions",
        "organizations_url": "https://api.github.com/users/COMITTER_NAME/orgs",
        "repos_url": "https://api.github.com/users/COMITTER_NAME/repos",
        "events_url": "https://api.github.com/users/COMITTER_NAME/events{/privacy}",
        "received_events_url": "https://api.github.com/users/COMITTER_NAME/received_events",
        "type": "User",
        "site_admin": false
      },
      "repo": {
        "id": REPOSITRY_ID,
        "name": "REPOSITRY_NAME",
        "full_name": "COMITTER_NAME/REPOSITRY_NAME",
        "owner": {
          "login": "COMITTER_NAME",
          "id": COMITTER_ID,
          "avatar_url": "https://avatars.githubusercontent.com/u/COMITTER_ID?v=3",
          "gravatar_id": "",
          "url": "https://api.github.com/users/COMITTER_NAME",
          "html_url": "https://github.com/COMITTER_NAME",
          "followers_url": "https://api.github.com/users/COMITTER_NAME/followers",
          "following_url": "https://api.github.com/users/COMITTER_NAME/following{/other_user}",
          "gists_url": "https://api.github.com/users/COMITTER_NAME/gists{/gist_id}",
          "starred_url": "https://api.github.com/users/COMITTER_NAME/starred{/owner}{/repo}",
          "subscriptions_url": "https://api.github.com/users/COMITTER_NAME/subscriptions",
          "organizations_url": "https://api.github.com/users/COMITTER_NAME/orgs",
          "repos_url": "https://api.github.com/users/COMITTER_NAME/repos",
          "events_url": "https://api.github.com/users/COMITTER_NAME/events{/privacy}",
          "received_events_url": "https://api.github.com/users/COMITTER_NAME/received_events",
          "type": "User",
          "site_admin": false
        },
        "private": false,
        "html_url": "https://github.com/COMITTER_NAME/REPOSITRY_NAME",
        "description": "REPOSITRY_NAME",
        "fork": false,
        "url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME",
        "forks_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/forks",
        "keys_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/keys{/key_id}",
        "collaborators_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/collaborators{/collaborator}",
        "teams_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/teams",
        "hooks_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/hooks",
        "issue_events_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/issues/events{/number}",
        "events_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/events",
        "assignees_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/assignees{/user}",
        "branches_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/branches{/branch}",
        "tags_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/tags",
        "blobs_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/git/blobs{/sha}",
        "git_tags_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/git/tags{/sha}",
        "git_refs_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/git/refs{/sha}",
        "trees_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/git/trees{/sha}",
        "statuses_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/statuses/{sha}",
        "languages_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/languages",
        "stargazers_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/stargazers",
        "contributors_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/contributors",
        "subscribers_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/subscribers",
        "subscription_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/subscription",
        "commits_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/commits{/sha}",
        "git_commits_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/git/commits{/sha}",
        "comments_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/comments{/number}",
        "issue_comment_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/issues/comments{/number}",
        "contents_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/contents/{+path}",
        "compare_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/compare/{base}...{head}",
        "merges_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/merges",
        "archive_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/{archive_format}{/ref}",
        "downloads_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/downloads",
        "issues_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/issues{/number}",
        "pulls_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/pulls{/number}",
        "milestones_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/milestones{/number}",
        "notifications_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/notifications{?since,all,participating}",
        "labels_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/labels{/name}",
        "releases_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/releases{/id}",
        "deployments_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/deployments",
        "created_at": "2016-02-17T03:08:23Z",
        "updated_at": "2016-02-17T03:08:23Z",
        "pushed_at": "2016-02-17T05:29:37Z",
        "git_url": "git://github.com/COMITTER_NAME/REPOSITRY_NAME.git",
        "ssh_url": "git@github.com:COMITTER_NAME/REPOSITRY_NAME.git",
        "clone_url": "https://github.com/COMITTER_NAME/REPOSITRY_NAME.git",
        "svn_url": "https://github.com/COMITTER_NAME/REPOSITRY_NAME",
        "homepage": null,
        "size": 1,
        "stargazers_count": 0,
        "watchers_count": 0,
        "language": null,
        "has_issues": true,
        "has_downloads": true,
        "has_wiki": true,
        "has_pages": false,
        "forks_count": 0,
        "mirror_url": null,
        "open_issues_count": 0,
        "forks": 0,
        "open_issues": 0,
        "watchers": 0,
        "default_branch": "master"
      }
    },
    "base": {
      "label": "COMITTER_NAME:dev",
      "ref": "dev",
      "sha": "fb97775c0e24191c9f98aa54c4234481492d5c48",
      "user": {
        "login": "COMITTER_NAME",
        "id": COMITTER_ID,
        "avatar_url": "https://avatars.githubusercontent.com/u/COMITTER_ID?v=3",
        "gravatar_id": "",
        "url": "https://api.github.com/users/COMITTER_NAME",
        "html_url": "https://github.com/COMITTER_NAME",
        "followers_url": "https://api.github.com/users/COMITTER_NAME/followers",
        "following_url": "https://api.github.com/users/COMITTER_NAME/following{/other_user}",
        "gists_url": "https://api.github.com/users/COMITTER_NAME/gists{/gist_id}",
        "starred_url": "https://api.github.com/users/COMITTER_NAME/starred{/owner}{/repo}",
        "subscriptions_url": "https://api.github.com/users/COMITTER_NAME/subscriptions",
        "organizations_url": "https://api.github.com/users/COMITTER_NAME/orgs",
        "repos_url": "https://api.github.com/users/COMITTER_NAME/repos",
        "events_url": "https://api.github.com/users/COMITTER_NAME/events{/privacy}",
        "received_events_url": "https://api.github.com/users/COMITTER_NAME/received_events",
        "type": "User",
        "site_admin": false
      },
      "repo": {
        "id": REPOSITRY_ID,
        "name": "REPOSITRY_NAME",
        "full_name": "COMITTER_NAME/REPOSITRY_NAME",
        "owner": {
          "login": "COMITTER_NAME",
          "id": COMITTER_ID,
          "avatar_url": "https://avatars.githubusercontent.com/u/COMITTER_ID?v=3",
          "gravatar_id": "",
          "url": "https://api.github.com/users/COMITTER_NAME",
          "html_url": "https://github.com/COMITTER_NAME",
          "followers_url": "https://api.github.com/users/COMITTER_NAME/followers",
          "following_url": "https://api.github.com/users/COMITTER_NAME/following{/other_user}",
          "gists_url": "https://api.github.com/users/COMITTER_NAME/gists{/gist_id}",
          "starred_url": "https://api.github.com/users/COMITTER_NAME/starred{/owner}{/repo}",
          "subscriptions_url": "https://api.github.com/users/COMITTER_NAME/subscriptions",
          "organizations_url": "https://api.github.com/users/COMITTER_NAME/orgs",
          "repos_url": "https://api.github.com/users/COMITTER_NAME/repos",
          "events_url": "https://api.github.com/users/COMITTER_NAME/events{/privacy}",
          "received_events_url": "https://api.github.com/users/COMITTER_NAME/received_events",
          "type": "User",
          "site_admin": false
        },
        "private": false,
        "html_url": "https://github.com/COMITTER_NAME/REPOSITRY_NAME",
        "description": "REPOSITRY_NAME",
        "fork": false,
        "url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME",
        "forks_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/forks",
        "keys_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/keys{/key_id}",
        "collaborators_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/collaborators{/collaborator}",
        "teams_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/teams",
        "hooks_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/hooks",
        "issue_events_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/issues/events{/number}",
        "events_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/events",
        "assignees_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/assignees{/user}",
        "branches_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/branches{/branch}",
        "tags_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/tags",
        "blobs_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/git/blobs{/sha}",
        "git_tags_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/git/tags{/sha}",
        "git_refs_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/git/refs{/sha}",
        "trees_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/git/trees{/sha}",
        "statuses_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/statuses/{sha}",
        "languages_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/languages",
        "stargazers_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/stargazers",
        "contributors_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/contributors",
        "subscribers_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/subscribers",
        "subscription_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/subscription",
        "commits_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/commits{/sha}",
        "git_commits_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/git/commits{/sha}",
        "comments_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/comments{/number}",
        "issue_comment_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/issues/comments{/number}",
        "contents_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/contents/{+path}",
        "compare_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/compare/{base}...{head}",
        "merges_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/merges",
        "archive_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/{archive_format}{/ref}",
        "downloads_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/downloads",
        "issues_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/issues{/number}",
        "pulls_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/pulls{/number}",
        "milestones_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/milestones{/number}",
        "notifications_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/notifications{?since,all,participating}",
        "labels_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/labels{/name}",
        "releases_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/releases{/id}",
        "deployments_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/deployments",
        "created_at": "2016-02-17T03:08:23Z",
        "updated_at": "2016-02-17T03:08:23Z",
        "pushed_at": "2016-02-17T05:29:37Z",
        "git_url": "git://github.com/COMITTER_NAME/REPOSITRY_NAME.git",
        "ssh_url": "git@github.com:COMITTER_NAME/REPOSITRY_NAME.git",
        "clone_url": "https://github.com/COMITTER_NAME/REPOSITRY_NAME.git",
        "svn_url": "https://github.com/COMITTER_NAME/REPOSITRY_NAME",
        "homepage": null,
        "size": 1,
        "stargazers_count": 0,
        "watchers_count": 0,
        "language": null,
        "has_issues": true,
        "has_downloads": true,
        "has_wiki": true,
        "has_pages": false,
        "forks_count": 0,
        "mirror_url": null,
        "open_issues_count": 0,
        "forks": 0,
        "open_issues": 0,
        "watchers": 0,
        "default_branch": "master"
      }
    },
    "_links": {
      "self": {
        "href": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/pulls/3"
      },
      "html": {
        "href": "https://github.com/COMITTER_NAME/REPOSITRY_NAME/pull/3"
      },
      "issue": {
        "href": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/issues/3"
      },
      "comments": {
        "href": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/issues/3/comments"
      },
      "review_comments": {
        "href": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/pulls/3/comments"
      },
      "review_comment": {
        "href": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/pulls/comments{/number}"
      },
      "commits": {
        "href": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/pulls/3/commits"
      },
      "statuses": {
        "href": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/statuses/01867079073bc1ba1e342af7ace7567047d9911e"
      }
    },
    "merged": true,
    "mergeable": null,
    "mergeable_state": "unknown",
    "merged_by": {
      "login": "COMITTER_NAME",
      "id": COMITTER_ID,
      "avatar_url": "https://avatars.githubusercontent.com/u/COMITTER_ID?v=3",
      "gravatar_id": "",
      "url": "https://api.github.com/users/COMITTER_NAME",
      "html_url": "https://github.com/COMITTER_NAME",
      "followers_url": "https://api.github.com/users/COMITTER_NAME/followers",
      "following_url": "https://api.github.com/users/COMITTER_NAME/following{/other_user}",
      "gists_url": "https://api.github.com/users/COMITTER_NAME/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/COMITTER_NAME/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/COMITTER_NAME/subscriptions",
      "organizations_url": "https://api.github.com/users/COMITTER_NAME/orgs",
      "repos_url": "https://api.github.com/users/COMITTER_NAME/repos",
      "events_url": "https://api.github.com/users/COMITTER_NAME/events{/privacy}",
      "received_events_url": "https://api.github.com/users/COMITTER_NAME/received_events",
      "type": "User",
      "site_admin": false
    },
    "comments": 0,
    "review_comments": 0,
    "commits": 1,
    "additions": 3,
    "deletions": 1,
    "changed_files": 1
  },
  "repository": {
    "id": REPOSITRY_ID,
    "name": "REPOSITRY_NAME",
    "full_name": "COMITTER_NAME/REPOSITRY_NAME",
    "owner": {
      "login": "COMITTER_NAME",
      "id": COMITTER_ID,
      "avatar_url": "https://avatars.githubusercontent.com/u/COMITTER_ID?v=3",
      "gravatar_id": "",
      "url": "https://api.github.com/users/COMITTER_NAME",
      "html_url": "https://github.com/COMITTER_NAME",
      "followers_url": "https://api.github.com/users/COMITTER_NAME/followers",
      "following_url": "https://api.github.com/users/COMITTER_NAME/following{/other_user}",
      "gists_url": "https://api.github.com/users/COMITTER_NAME/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/COMITTER_NAME/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/COMITTER_NAME/subscriptions",
      "organizations_url": "https://api.github.com/users/COMITTER_NAME/orgs",
      "repos_url": "https://api.github.com/users/COMITTER_NAME/repos",
      "events_url": "https://api.github.com/users/COMITTER_NAME/events{/privacy}",
      "received_events_url": "https://api.github.com/users/COMITTER_NAME/received_events",
      "type": "User",
      "site_admin": false
    },
    "private": false,
    "html_url": "https://github.com/COMITTER_NAME/REPOSITRY_NAME",
    "description": "REPOSITRY_NAME",
    "fork": false,
    "url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME",
    "forks_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/forks",
    "keys_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/keys{/key_id}",
    "collaborators_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/collaborators{/collaborator}",
    "teams_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/teams",
    "hooks_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/hooks",
    "issue_events_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/issues/events{/number}",
    "events_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/events",
    "assignees_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/assignees{/user}",
    "branches_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/branches{/branch}",
    "tags_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/tags",
    "blobs_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/git/blobs{/sha}",
    "git_tags_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/git/tags{/sha}",
    "git_refs_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/git/refs{/sha}",
    "trees_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/git/trees{/sha}",
    "statuses_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/statuses/{sha}",
    "languages_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/languages",
    "stargazers_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/stargazers",
    "contributors_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/contributors",
    "subscribers_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/subscribers",
    "subscription_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/subscription",
    "commits_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/commits{/sha}",
    "git_commits_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/git/commits{/sha}",
    "comments_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/comments{/number}",
    "issue_comment_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/issues/comments{/number}",
    "contents_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/contents/{+path}",
    "compare_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/compare/{base}...{head}",
    "merges_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/merges",
    "archive_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/{archive_format}{/ref}",
    "downloads_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/downloads",
    "issues_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/issues{/number}",
    "pulls_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/pulls{/number}",
    "milestones_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/milestones{/number}",
    "notifications_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/notifications{?since,all,participating}",
    "labels_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/labels{/name}",
    "releases_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/releases{/id}",
    "deployments_url": "https://api.github.com/repos/COMITTER_NAME/REPOSITRY_NAME/deployments",
    "created_at": "2016-02-17T03:08:23Z",
    "updated_at": "2016-02-17T03:08:23Z",
    "pushed_at": "2016-02-17T05:29:37Z",
    "git_url": "git://github.com/COMITTER_NAME/REPOSITRY_NAME.git",
    "ssh_url": "git@github.com:COMITTER_NAME/REPOSITRY_NAME.git",
    "clone_url": "https://github.com/COMITTER_NAME/REPOSITRY_NAME.git",
    "svn_url": "https://github.com/COMITTER_NAME/REPOSITRY_NAME",
    "homepage": null,
    "size": 1,
    "stargazers_count": 0,
    "watchers_count": 0,
    "language": null,
    "has_issues": true,
    "has_downloads": true,
    "has_wiki": true,
    "has_pages": false,
    "forks_count": 0,
    "mirror_url": null,
    "open_issues_count": 0,
    "forks": 0,
    "open_issues": 0,
    "watchers": 0,
    "default_branch": "master"
  },
  "sender": {
    "login": "COMITTER_NAME",
    "id": COMITTER_ID,
    "avatar_url": "https://avatars.githubusercontent.com/u/COMITTER_ID?v=3",
    "gravatar_id": "",
    "url": "https://api.github.com/users/COMITTER_NAME",
    "html_url": "https://github.com/COMITTER_NAME",
    "followers_url": "https://api.github.com/users/COMITTER_NAME/followers",
    "following_url": "https://api.github.com/users/COMITTER_NAME/following{/other_user}",
    "gists_url": "https://api.github.com/users/COMITTER_NAME/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/COMITTER_NAME/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/COMITTER_NAME/subscriptions",
    "organizations_url": "https://api.github.com/users/COMITTER_NAME/orgs",
    "repos_url": "https://api.github.com/users/COMITTER_NAME/repos",
    "events_url": "https://api.github.com/users/COMITTER_NAME/events{/privacy}",
    "received_events_url": "https://api.github.com/users/COMITTER_NAME/received_events",
    "type": "User",
    "site_admin": false
  }
}

```


masterブランチ宛のプルリクエストがマージされて、クローズされるタイミングで通知を飛ばしたいので、以下の場合分けで通知を飛ばすようにしました

```js

    var payload = WEBHOOK_JSON_DATA,
        base_branch = payload.pull_request.base.ref
        merged_at = payload.pull_request.merged_at,
        target_branch = "master";
    // 対象のブランチへのプルリクエストがマージされた場合
    if (target_branch == base_branch && payload.action == "closed" && merged_at){
        //chatwork経メッセージ送信
    }
```