POST /orgs/:org/hooks
| Name | Type | Description |
|---|---|---|
name |
string |
Required. Must be passed as "web". |
config |
object |
Required. Key/value pairs to provide settings for this webhook. These are defined below. |
events |
array |
Determines what events the hook is triggered for. Default: ["push"]. |
active |
boolean |
Determines if notifications are sent when the webhook is triggered. Set to true to send notifications. Default: true. |
The config object can accept the following keys:
| Name | Type | Description |
|---|---|---|
url |
string |
Required. The URL to which the payloads will be delivered. |
content_type |
string |
The media type used to serialize the payloads. Supported values include json and form. The default is form. |
secret |
string |
If provided, the secret will be used as the key to generate the HMAC hex digest value in the X-Hub-Signature header. |
insecure_ssl |
string |
Determines whether the SSL certificate of the host for url will be verified when delivering payloads. Supported values include 0 (verification is performed) and 1 (verification is not performed). The default is 0. We strongly recommend not setting this to 1 as you are subject to man-in-the-middle and other attacks.
|
Here's how you can create a hook that posts payloads in JSON format:
{
"name": "web",
"active": true,
"events": [
"push",
"pull_request"
],
"config": {
"url": "http://example.com/webhook",
"content_type": "json"
}
}
Status: 201 Created
Location: https://api.github.com/orgs/octocat/hooks/1
{
"id": 1,
"url": "https://api.github.com/orgs/octocat/hooks/1",
"ping_url": "https://api.github.com/orgs/octocat/hooks/1/pings",
"name": "web",
"events": [
"push",
"pull_request"
],
"active": true,
"config": {
"url": "http://example.com",
"content_type": "json"
},
"updated_at": "2011-09-06T20:39:23Z",
"created_at": "2011-09-06T17:26:27Z"
}