Skip to main content

Webhooks

Webhooks send data to HTTP endpoints from actions in your repository, such as opened pull requests, new branches, and more.

Create a webhook

  1. In the Webhooks view of your repository, select New Webhook
  2. Give the webhook a name and optional description
  3. Enter your endpoint in the Payload URL field
  4. If your endpoint requires authentication, provide your token in the Secret field
  5. Select Send me everything to send all events to your endpoint, or choose Let me select individual events
  6. Select Enable SSL verification if your endpoint supports it
  7. Optionally uncheck Enabled to disable the webhook, then select Create Webhook

Payload

This is an example webhook payload for when a pull request is opened.

{
"trigger": "pullreq_created",
"repo": {
"id": 13,
"path": "kmpySmUISimoRrJL6NL73w/myOrg/myProject/aba",
"uid": "aba",
"default_branch": "main",
"git_url": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/myOrg/myProject/aba.git"
},
"principal": {
"id": 8,
"uid": "0osgWsTZRsSZ8RWfjLRkEg",
"display_name": "default",
"email": "default@harness.io",
"type": "user",
"created": 1675390885380,
"updated": 1675390885380
},
"pull_req": {
"number": 4,
"state": "open",
"is_draft": false,
"title": "aw",
"source_repo_id": 13,
"source_branch": "b",
"target_repo_id": 13,
"target_branch": "main",
"merge_strategy": null
},
"target_ref": {
"name": "refs/heads/main",
"repo": {
"id": 13,
"path": "kmpySmUISimoRrJL6NL73w/myOrg/myProject/aba",
"uid": "aba",
"default_branch": "main",
"git_url": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/myOrg/myProject/aba.git"
}
},
"ref": {
"name": "refs/heads/b",
"repo": {
"id": 13,
"path": "kmpySmUISimoRrJL6NL73w/myOrg/myProject/aba",
"uid": "aba",
"default_branch": "main",
"git_url": "http://localhost:3000/git/kmpySmUISimoRrJL6NL73w/myOrg/myProject/aba.git"
}
},
"sha": "d74b1ebfe520ac01b209dd9085f005884cc9f4cd",
"commit": {
"sha": "d74b1ebfe520ac01b209dd9085f005884cc9f4cd",
"message": "Update b.txt",
"author": {
"identity": {
"name": "Admin",
"email": "admin@harness.io"
},
"when": "2023-01-31T22:01:55-08:00"
},
"committer": {
"identity": {
"name": "Admin",
"email": "admin@harness.io"
},
"when": "2023-01-31T22:01:55-08:00"
}
}
}
AIDA logo
AIDA logo

Harness AIDA Chatbot

AI Development Assistant


Today, March 13, 2:11pm

AIDA logo

Accelerate your software delivery with the powerful capabilities of Harness’s Platform.

AIDA logo

How can I help?

Log into your Harness Account to access AIDA