API to list Webhook recent deliveries?

There is a developer guide “Testing Webhooks” at https://developer.github.com/webhooks/testing/. Are there corresponding APIs to list Webhook recent deliveries and show details of individual one? 

4 Likes

To my knowledge, there isn’t an API to list webhook deliveries. You can use the Events API to list events for a repo, org or user though and find the payload you’re looking for that way:

https://developer.github.com/v3/activity/events/

Depending on how recent the event is and how busy the target is, you may be sifting through a lot of data that way though. You would have to watch out for rate limits.

I did try the events API but could not find the info I wanted. For example, in Settings->Integration and Service, if I click the “Test service” to trigger Travis CI, I could not find such event and its request/response info through events API listed on https://developer.github.com/v3/activity/events.

When I request:

/api/v3/orgs/:org/hooks/:hook_id/deliveries

I receive:

{
    "message": "If you would like to help us test the Webhook deliveries API during its preview period, you must specify a custom media type in the 'Accept' header. Please see the docs for full details.",
    "documentation_url": "https://developer.github.com/enterprise/2.20/v3"
}

I do not find the right Accept header, have you any idea?

I tried this as well for our github app that handles check_run events and couldn’t find such events either.
I could see PR events like “opened” and “closed” in the list produced by the repository events endpoint but not check runs.

Also note this: https://developer.github.com/v3/activity/events/#events

Events support pagination, however the per_page option is unsupported. The fixed page size is 30 items. Fetching up to ten pages is supported, for a total of 300 events.

So the list is pretty limited anyway.