Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 2

GitHub Web Hooks documentation

Solved! Go to Solution.

Where can I find documentation to triggering webhooks when a comment is created on a PR? Also, where is it explained that a PR is just an issue with code?


I just finished 3 hours long search for how to send a GitHub webhook when a comment is created on a PR. I believe I searched the Webhooks documentation through and through, and nowhere, is any mention about the fact that comments on a PR actually trigger the `issue_comment` trigger. I had to randomly stumble uppon [this](


I believe there has to be more information about that fact than that short sentence. There is no way you mention that "a Pull Request is just an Issue with code" only once. Mainly, if the documentation itself states "This may seem counterintuitive at first.".


Also, sorry for being too hostile, but I feel exhasted after searching for such a simple thing for so long, and the authors themselves acknowledged that it is counterintuitive. Yet, they never explained the reasons for it, nor was that information easy to find.

1 Reply
Community Manager
Message 2 of 2

Re: GitHub Web Hooks documentation

Hey @VladMasarik,


Thanks for being here, and thanks for taking the time to write this feedback. I can see how is very frustrating to not be able to find clear documentation. Let me see if I can help clarify some of your questions and rest assured I'll pass on your feedback to our docs team.


Here is a link to the current docs for our Webhooks product ( These are configured at repository level and the principal is that you can subscribe to events that happen in the given repository and receive a payload representing this, which you can then process as you see fit, storing the data locally or triggering some desired behavior.


When you create a hook you designate a URL for this hook. This has to be a publicly exposed endpoint that can receive POST requests. Once you have this you can then configure your hook to either receive form-encoded POST data, or JSON encoded POST data. Finally, you pick the events that you'd like to subscribe to this hook to.


When an event occurs, such as a push or triggered when a pull request is assignedunassignedlabeledunlabeledopenededitedclosedreopenedsynchronizeready_for_reviewlockedunlocked we will check the hooks to see if there are any that are subscribed to this event. If there is, we will generate a payload and through a job on our side trigger a POST request with this payload to your endpoint. The payload will look something like:

  "ref": "refs/tags/simple-tag",
  "before": "a10867b14bb761a232cd80139fbd4c0d33264240",
  "after": "0000000000000000000000000000000000000000",
  "created": false,
  "deleted": true,
  "forced": false,
  "base_ref": null,
  "compare": "",
  "commits": [

  "head_commit": null,
  "repository": {
    "id": 135493233,
    "node_id": "MDEwOlJlcG9zaXRvcnkxMzU0OTMyMzM=",
    "name": "Hello-World",
    "full_name": "Codertocat/Hello-World",
    "owner": {
      "name": "Codertocat",
      "email": "",
      "login": "Codertocat",
      "id": 21031067,
      "node_id": "MDQ6VXNlcjIxMDMxMDY3",
      "avatar_url": "",
      "gravatar_id": "",
      "url": "",
      "html_url": "",
      "followers_url": "",
      "following_url": "{/other_user}",
      "gists_url": "{/gist_id}",
      "starred_url": "{/owner}{/repo}",
      "subscriptions_url": "",
      "organizations_url": "",
      "repos_url": "",
      "events_url": "{/privacy}",
      "received_events_url": "",
      "type": "User",
      "site_admin": false
    "private": false,
    "html_url": "",
    "description": null,
    "fork": false,
    "url": "",
    "forks_url": "",
    "keys_url": "{/key_id}",
    "collaborators_url": "{/collaborator}",
    "teams_url": "",
    "hooks_url": "",
    "issue_events_url": "{/number}",
    "events_url": "",
    "assignees_url": "{/user}",
    "branches_url": "{/branch}",
    "tags_url": "",
    "blobs_url": "{/sha}",
    "git_tags_url": "{/sha}",
    "git_refs_url": "{/sha}",
    "trees_url": "{/sha}",
    "statuses_url": "{sha}",
    "languages_url": "",
    "stargazers_url": "",
    "contributors_url": "",
    "subscribers_url": "",
    "subscription_url": "",
    "commits_url": "{/sha}",
    "git_commits_url": "{/sha}",
    "comments_url": "{/number}",
    "issue_comment_url": "{/number}",
    "contents_url": "{+path}",
    "compare_url": "{base}...{head}",
    "merges_url": "",
    "archive_url": "{archive_format}{/ref}",
    "downloads_url": "",
    "issues_url": "{/number}",
    "pulls_url": "{/number}",
    "milestones_url": "{/number}",
    "notifications_url": "{?since,all,participating}",
    "labels_url": "{/name}",
    "releases_url": "{/id}",
    "deployments_url": "",
    "created_at": 1527711484,
    "updated_at": "2018-05-30T20:18:35Z",
    "pushed_at": 1527711528,
    "git_url": "git://",
    "ssh_url": "",
    "clone_url": "",
    "svn_url": "",
    "homepage": null,
    "size": 0,
    "stargazers_count": 0,
    "watchers_count": 0,
    "language": null,
    "has_issues": true,
    "has_projects": true,
    "has_downloads": true,
    "has_wiki": true,
    "has_pages": true,
    "forks_count": 0,
    "mirror_url": null,
    "archived": false,
    "open_issues_count": 2,
    "license": null,
    "forks": 0,
    "open_issues": 2,
    "watchers": 0,
    "default_branch": "master",
    "stargazers": 0,
    "master_branch": "master"
  "pusher": {
    "name": "Codertocat",
    "email": ""
  "sender": {
    "login": "Codertocat",
    "id": 21031067,
    "node_id": "MDQ6VXNlcjIxMDMxMDY3",
    "avatar_url": "",
    "gravatar_id": "",
    "url": "",
    "html_url": "",
    "followers_url": "",
    "following_url": "{/other_user}",
    "gists_url": "{/gist_id}",
    "starred_url": "{/owner}{/repo}",
    "subscriptions_url": "",
    "organizations_url": "",
    "repos_url": "",
    "events_url": "{/privacy}",
    "received_events_url": "",
    "type": "User",
    "site_admin": false


If the event has multiple actions, for instance an issue event might have an event for created, updated, a new label being added etc. Then there is an action key in this payload that denotes what action triggered this event.

Once you receive this it's up to you how you decide to process this, for instance, you might store this in a db or key/value no-db store, you might decide to store all of the data, or just what you need for your personal site - the choice is entirely yours.


I hope this helps, and if you have any further questions feel free to reach out.




Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!