octokit.rest

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

string The token will be passed in the authorization header.

string

string

string Use web to create a webhook. Default: web. This parameter only accepts the value web.

object Key/value pairs to provide settings for this webhook. These are defined below.

string The URL to which the payloads will be delivered.

string The media type used to serialize the payloads. Supported values include json and form. The default is form.

string If provided, the secret will be used as the key to generate the HMAC hex digest value for delivery signature headers.

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.

string

string

string[] Determines what events the hook is triggered for.

boolean Determines if notifications are sent when the webhook is triggered. Set to true to send notifications.

Request

POST https://api.github.com/repos///hooks
authorization: bearer undefined
accept: application/vnd.github.v3+json
user-agent: octokit.rest
content-length: 0


Example Response

Status: 201
{
  "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",
  "last_response": {
    "code": null,
    "status": "unused",
    "message": null
  }
}

See documentation on GitHub developer guides