Create a repository webhook
Repositories can have multiple webhooks installed. Each webhook should have a unique config. Multiple webhooks can
share the same config as long as those webhooks do not have any events that overlap.
Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ”The account owner of the repository. The name is not case sensitive.
The name of the repository without the .git extension. The name is not case sensitive.
Request Body
Section titled “ Request Body ”object
Use web to create a webhook. Default: web. This parameter only accepts the value web.
Key/value pairs to provide settings for this webhook.
object
The URL to which the payloads will be delivered.
The media type used to serialize the payloads. Supported values include json and form. The default is form.
If provided, the secret will be used as the key to generate the HMAC hex digest value for delivery signature headers.
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.
Determines what events the hook is triggered for.
Determines if notifications are sent when the webhook is triggered. Set to true to send notifications.
Examples
{ "name": "web", "active": true, "events": [ "push", "pull_request" ], "config": { "url": "https://example.com/webhook", "content_type": "json", "insecure_ssl": "0" }}Responses
Section titled “ Responses ”Response
Webhooks for repositories.
object
Unique identifier of the webhook.
The name of a valid service, use ‘web’ for a webhook.
Determines whether the hook is actually triggered on pushes.
Determines what events the hook is triggered for. Default: [‘push’].
Configuration object of the webhook
object
The URL to which the payloads will be delivered.
The media type used to serialize the payloads. Supported values include json and form. The default is form.
If provided, the secret will be used as the key to generate the HMAC hex digest value for delivery signature headers.
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.
object
Examples
{ "type": "Repository", "id": 12345678, "name": "web", "active": true, "events": [ "push", "pull_request" ], "config": { "content_type": "json", "insecure_ssl": "0", "url": "https://example.com/webhook" }, "updated_at": "2019-06-03T00:57:16Z", "created_at": "2019-06-03T00:57:16Z", "url": "https://api.github.com/repos/octocat/Hello-World/hooks/12345678", "test_url": "https://api.github.com/repos/octocat/Hello-World/hooks/12345678/test", "ping_url": "https://api.github.com/repos/octocat/Hello-World/hooks/12345678/pings", "deliveries_url": "https://api.github.com/repos/octocat/Hello-World/hooks/12345678/deliveries", "last_response": { "code": null, "status": "unused", "message": null }}Headers
Section titled “ Headers ”Example
https://api.github.com/repos/octocat/Hello-World/hooks/12345678Forbidden
Basic Error
object
Example generated
{ "message": "example", "documentation_url": "example", "url": "example", "status": "example"}Resource not found
Basic Error
object
Example generated
{ "message": "example", "documentation_url": "example", "url": "example", "status": "example"}Validation failed, or the endpoint has been spammed.
Validation Error
object
object
Example generated
{ "message": "example", "documentation_url": "example", "errors": [ { "resource": "example", "field": "example", "message": "example", "code": "example", "index": 1, "value": [ "example" ] } ]}