API / handle-origin-pull-request-comment-webhooks

API

Handle Origin pull request comment created webhooks

Subscribe to pull_request.comment.created. Official payload: llms-full.txt → Events and OpenAPI PullRequestCommentWebhookPayload. Reactions use a separate family: Handle Origin pull request comment reaction webhooks.

Origin is in Early Beta and subject to change. Subscribing needs repository:pull_requests:reviews:read. Comments filed inside Create Pull Request Review emit nothing until the review submits; then Origin delivers one pull_request.comment.created per comment.

Events

event.type When it fires
pull_request.comment.created A visible pull request comment is created.

Payload fields

Field Meaning
pullRequest Pull request reference (id, number, nested repository)
comment Created comment (id, body, author, timestamps, thread)
comment.thread Thread the comment belongs to

A comment that opens its thread carries the thread's diff anchor inline (version, path, side, startLine, endLine). A reply carries comment.thread.id alone. Thread resolution state is not part of the event — read it with Get Pull Request Comment when you need resolvedAt.

Sample event.payload:

{
  "pullRequest": {
    "id": "pr_01k2ja2000e0080000000000d4",
    "number": "17",
    "repository": {
      "id": "repo_01k2ja2000e0080000000000q4",
      "name": "rocket",
      "owner": {
        "slug": "acme",
        "id": "ns_01k2ja2000e0080000000000p3",
        "type": "team"
      }
    }
  },
  "comment": {
    "id": "cmt_01k2ja2000e0080000000000e5",
    "thread": {
      "id": "cth_01k2ja2000e0080000000000s6",
      "version": {
        "number": "3",
        "headSha": "9a41f0c3d2b8e7f6a5c4d3e2f1b0a9c8d7e6f5a4",
        "baseSha": "3b1f9c2d8a7e6f5049c8b7a6d5e4f3a2b1c0d9e8",
        "createdAt": "2026-08-01T09:30:00Z"
      },
      "path": "src/telemetry/retry.ts",
      "side": "right",
      "startLine": 42,
      "endLine": 45,
      "createdAt": "2026-08-01T09:30:00Z",
      "updatedAt": "2026-08-02T14:45:00Z"
    },
    "body": "Should the retry budget be configurable?",
    "author": {
      "user": {
        "id": "user_01k2ja2000e0080000000000c3",
        "email": "jane@acme.dev"
      }
    },
    "createdAt": "2026-08-01T09:30:00Z",
    "updatedAt": "2026-08-02T14:45:00Z"
  }
}

Receiver tips

  1. Verify the signature, then handle event.type === "pull_request.comment.created".
  2. Materialize a new thread from the opener's inline anchor; for replies, group by comment.thread.id.
  3. Deduplicate on webhook-id. Review-bundled comments arrive as a burst after submit — process each delivery once.
  4. Answer within 10 seconds; fetch full thread history with List Pull Request Comments (threadIds) off the hot path.

Pitfalls

  • Do not expect comment events while a review is still a draft — they fire on submit.
  • Do not treat missing path / side as an error on general-discussion threads; those fields are empty / unset there.
  • Reaction add/remove events are a different subscription (pull_request.comment.reaction.*).