diff --git a/content/webhooks/testing-and-troubleshooting-webhooks/redelivering-webhooks.md b/content/webhooks/testing-and-troubleshooting-webhooks/redelivering-webhooks.md index 2640822c63..46a8d01fbd 100644 --- a/content/webhooks/testing-and-troubleshooting-webhooks/redelivering-webhooks.md +++ b/content/webhooks/testing-and-troubleshooting-webhooks/redelivering-webhooks.md @@ -12,7 +12,7 @@ topics: ## About redelivering webhooks -You may want to redeliver a webhook to help you test your application or to recover from server downtime. You can redeliver webhook deliveries that occurred in the past 30 days. +You may want to redeliver a webhook to help you test your application or to recover from server downtime. You can redeliver webhook deliveries that occurred in the past 30 days. {% data variables.product.company_short %} does not automatically redeliver failed deliveries. ## Redelivering repository webhooks @@ -91,8 +91,6 @@ Only the owner of the sponsored account can redeliver sponsorship webhooks for t Only enterprise owners can redeliver webhooks in that enterprise. -{% ifversion ghes or ghae %}You can use the {% data variables.product.company_short %} web interface or the REST API to redeliver global webhooks. For more information about using the REST API to redeliver webhooks, see "[AUTOTITLE](/rest/enterprise-admin/global-webhooks)."{% endif %} - {% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.settings-tab %} {% data reusables.enterprise-accounts.hooks-tab %} diff --git a/content/webhooks/testing-and-troubleshooting-webhooks/viewing-webhook-deliveries.md b/content/webhooks/testing-and-troubleshooting-webhooks/viewing-webhook-deliveries.md index b9716c792e..feccc7b6bc 100644 --- a/content/webhooks/testing-and-troubleshooting-webhooks/viewing-webhook-deliveries.md +++ b/content/webhooks/testing-and-troubleshooting-webhooks/viewing-webhook-deliveries.md @@ -93,8 +93,6 @@ Only the owner of the sponsored account can view deliveries for sponsorship webh Only enterprise owners can view deliveries for webhooks in that enterprise. -{% ifversion ghes or ghae %}You can use the {% data variables.product.company_short %} web interface or the REST API to view recent deliveries for global webhooks. For more information about using the REST API to view recent deliveries, see "[AUTOTITLE](/rest/enterprise-admin/global-webhooks)."{% endif %} - {% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.settings-tab %} {% data reusables.enterprise-accounts.hooks-tab %} diff --git a/content/webhooks/using-webhooks/handling-failed-webhook-deliveries.md b/content/webhooks/using-webhooks/handling-failed-webhook-deliveries.md new file mode 100644 index 0000000000..825af38d95 --- /dev/null +++ b/content/webhooks/using-webhooks/handling-failed-webhook-deliveries.md @@ -0,0 +1,33 @@ +--- +title: Handling failed webhook deliveries +shortTitle: Handling failed deliveries +intro: '{% data variables.product.company_short %} does not automatically redeliver failed webhook deliveries, but you can handle failed deliveries manually or by writing code.' +versions: + fpt: '*' + ghes: '*' + ghae: '*' + ghec: '*' +topics: + - Webhooks +--- + +## About webhook delivery failures + +A webhook delivery can fail for multiple reasons. For example, if your server is down or takes longer than {% ifversion fpt or ghec %}10{% else %}30{% endif %} seconds to respond, {% data variables.product.company_short %} will record the delivery as a failure. + +{% data variables.product.company_short %} does not automatically redeliver failed deliveries. + +## Handling delivery failures + +You can manually redeliver failed deliveries. For more information, see "[AUTOTITLE](/webhooks/testing-and-troubleshooting-webhooks/redelivering-webhooks)." + +You can also write a script that checks for failed deliveries and attempts to redeliver any that failed. Your script should run on a schedule and do the following: + +- Use the {% data variables.product.company_short %} REST API to fetch data about any webhook deliveries that were attempted since the last time that your script ran. For more information, see "[AUTOTITLE](/rest/webhooks/repo-deliveries#list-deliveries-for-a-repository-webhook)," "[AUTOTITLE](/rest/orgs/webhooks#list-deliveries-for-an-organization-webhook)," and "[AUTOTITLE](/rest/apps/webhooks#list-deliveries-for-an-app-webhook)." + + {% ifversion fpt %}There are no API endpoints to get data about {% data variables.product.prodname_marketplace %} webhooks or {% data variables.product.prodname_sponsors %} webhooks.{% endif %}{% ifversion ghec %}There are no API endpoints to get data about {% data variables.product.prodname_marketplace %} webhooks, {% data variables.product.prodname_sponsors %} webhooks, or global webhooks.{% endif %}{% ifversion ghes or ghae %}There are no API endpoints to get data about global webhook deliveries.{% endif %} + +- Look at the fetched data to see if any deliveries failed. The data for a failed delivery will have a `status` value that is not `OK`. +- Use the {% data variables.product.company_short %} REST API to redeliver any deliveries that failed. For more information, see "[AUTOTITLE](/rest/webhooks/repo-deliveries#redeliver-a-delivery-for-a-repository-webhook)," "[AUTOTITLE](/rest/orgs/webhooks#redeliver-a-delivery-for-an-organization-webhook)," and "[AUTOTITLE](/rest/apps/webhooks#redeliver-a-delivery-for-an-app-webhook)." + +If a webhook delivery fails repeatedly, you should investigate the cause. Each failed delivery will give a reason for failure. For example, if the delivery failure indicates that {% data variables.product.company_short %} couldn't connect to the host, you should verify that the domain portion of the webhook URL that you specified resolves to an IP address. diff --git a/content/webhooks/using-webhooks/index.md b/content/webhooks/using-webhooks/index.md index 42b73fdd11..c8b19cb470 100644 --- a/content/webhooks/using-webhooks/index.md +++ b/content/webhooks/using-webhooks/index.md @@ -12,6 +12,7 @@ children: - /creating-webhooks - /handling-webhook-deliveries - /securing-your-webhooks + - /handling-failed-webhook-deliveries - /disabling-webhooks - /best-practices-for-using-webhooks ---