You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/v3/repos/hooks.md
+5-7Lines changed: 5 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -43,17 +43,17 @@ Repositories can have multiple webhooks installed. Each webhook should have a un
43
43
Name | Type | Description
44
44
-----|------|--------------
45
45
`name`|`string` |**Required**. Use`web` for a webhook or use the name of a valid service. (See <ahref='https://api.github.com/hooks'data-proofer-ignore>/hooks</a> for the list of valid service names.)
46
-
`config`|`object` |**Required**. Key/value pairs to provide settings for this hook. These settings vary betweenthe servicesand are defined in the[github-services](https://github.com/github/github-services) repository. Booleans are stored internally as "1" for true, and "0" for false. Any JSON`true`/`false` values will be converted automatically.
46
+
`config`|`object` |**Required**. Key/value pairs to provide settings for this hook. These settings vary betweenhooksand some are defined in the[github-services](https://github.com/github/github-services) repository. Booleans are stored internally as "1" for true, and "0" for false. Any JSON`true`/`false` values will be converted automatically.
47
47
`events`|`array` | Determines what events the hook is triggered for. Default:`["push"]`
48
48
`active`|`boolean` | Determines whether the hook is actually triggered on pushes.
49
49
50
50
####Example
51
51
52
-
To create[a webhook](/webhooks),[the following fields are required](https://github.com/github/github-services/blob/master/lib/services/web.rb#L4-11) by the`config`:
52
+
To create[a webhook](/webhooks), the following fields are required by the`config`:
53
53
54
54
*`url`: A required string defining the URL to which the payloads will be delivered.
55
55
*`content_type`: An optional string defining the media type used to serialize the payloads. Supported values include`json` and`form`. The default is`form`.
56
-
*`secret`: An optional string that's passed with the HTTP requests as an`X-Hub-Signature` header. The value of this header is computed as the[HMAC hex digest of the body, using the`secret` as the key][hub-signature].
56
+
*`secret`: An optional string that's passed with the HTTP requests as an`X-Hub-Signature` header. The value of this header is computed as the HMAC hex digest of the body, using the`secret` as the key.
57
57
*`insecure_ssl`: An optional string that 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"`.
58
58
59
59
Here's how you can create a hook that posts payloads in JSON format:
@@ -80,7 +80,7 @@ Here's how you can create a hook that posts payloads in JSON format:
80
80
81
81
Name | Type | Description
82
82
-----|------|--------------
83
-
`config`|`object` | Key/value pairs to provide settings for this hook. Modifying this will replace the entire config object. These settings vary betweenthe servicesand are defined in the[github-services](https://github.com/github/github-services) repository. Booleans are stored internally as "1" for true, and "0" for false. Any JSON`true`/`false` values will be converted automatically.
83
+
`config`|`object` | Key/value pairs to provide settings for this hook. Modifying this will replace the entire config object. These settings vary betweenhooksand some are defined in the[github-services](https://github.com/github/github-services) repository. Booleans are stored internally as "1" for true, and "0" for false. Any JSON`true`/`false` values will be converted automatically.
84
84
`events`|`array` | Determines what events the hook is triggered for. This replaces the entire array of events. Default:`["push"]`
85
85
`add_events`|`array` | Determines a list of events to be added to the list of events that the Hook triggers for.
86
86
`remove_events`|`array` | Determines a list of events to be removed from the list of events that the Hook triggers for.
``hub.topic``|`string` |**Required**. The URI of the GitHub repository to subscribe to. The path must be in the format of`/:owner/:repo/events/:event`.
207
207
``hub.callback``|`string` | The URI to receive the updates to the topic.
208
-
``hub.secret``|`string` | A shared secret key that generates a SHA1 HMAC of the outgoing body content. You can verify a push came from GitHub by comparing the raw request body with the contents of the`X-Hub-Signature` header. You can see[our Ruby implementation][ruby-secret], or[the PubSubHubbub documentation][pshb-secret] for more details.
208
+
``hub.secret``|`string` | A shared secret key that generates a SHA1 HMAC of the outgoing body content. You can verify a push came from GitHub by comparing the raw request body with the contents of the`X-Hub-Signature` header. You can see[the PubSubHubbub documentation][pshb-secret] for more details.
When your secret token is set, GitHub uses it to create a hash signature with each payload. You can find details on the implementation[in our Ruby implementation][ruby-secret].
34
+
When your secret token is set, GitHub uses it to create a hash signature with each payload.
35
35
36
36
This hash signature is passed along with each request in the headers as`X-Hub-Signature`. Suppose you have a basic server listening to webhooks that looks like this:
37
37
@@ -68,5 +68,4 @@ Obviously, your language and server implementations may differ than this code. T
68
68
69
69
* Using a plain`==` operator is**not advised**. A method like[`secure_compare`][secure_compare] performs a "constant time" string comparison, which renders it safe from certain timing attacks against regular equality operators.