Creating a webhook for a GitHub Marketplace listing

After listing your app on GitHub Marketplace, you can add webhooks that notify you when changes to account plans occur.

To create a webhook for your GitHub Marketplace listing, you'll need to configure the payload URL and content type. To secure your webhook, you'll want to add a secret.

Configuring a webhook

Payload URL

This is the URL of the server endpoint that will receive the webhook POST requests.

Content type

Webhooks can be delivered using different content types:

  • The application/json content type will deliver the JSON payload directly as the body of the POST.
  • The application/x-www-form-urlencoded content type will send the JSON payload as a form parameter called "payload".

Choose the one that best fits your needs. GitHub recommends using the application/json content type.

Secret

Setting a secret allows you to ensure that POST requests sent to the payload URL are from GitHub. When you set a secret you'll receive the X-Hub-Signature header in the webhook POST request. For more details on how to use the secret and the X-Hub-Signature header to secure your webhook payloads see "Securing your webhooks."

Creating a webhook

The marketplace_purchase event webhook can only be setup from your application's GitHub Marketplace listing page.

  1. In the upper-right corner of any page, click your profile photo, then click Settings. Settings icon in the user bar

  2. In the left sidebar, click Developer settings. Developer settings section

  3. In the left sidebar, click either OAuth Apps or GitHub Apps depending on the GitHub Marketplace listing you'd like to manage. Note: You can also manage your listing by navigating to https://github.com/marketplace/manage. App type selection

  4. Select the app listing whose webhooks you'd like to add.

  5. Click Edit Marketplace listing.
  6. In the left sidebar, click Webhook.
  7. In "Payload URL", type the payload URL for your app's webhook.
  8. In the "Content type" dropdown, select the content type for your app's webhook.
  9. In "Secret", type the secret token for your app's webhook (optional).
  10. Click Create webhook.