Hi, I am trying to use the Events API to fetch all events (both public and private events) that happen within an org. I tried using the GET /users/:username/events/orgs/:org API. It returns the private events (great!), but it only returns a small number of events (45 events in my case) that occured very recently (I tried paging through the events response, but still only 45 events are returned). Is there anyway to fetch all events that happen within a certain time window?
Thank you for being here and apologies for the delay in response. Unfortunately there isn’t a single endpoint that provides what you are looking for, however we may still be able to help you out here.
For scenarios such as this we provide webhooks: https://developer.github.com/webhooks/ webhooks
Webhooks can be installed on an organization or a specific repository. Once installed, the webhook will be triggered each time one or more subscribed events occurs, sending a payload representing that event to an endpoint on your server, that is configured with your hook.
So, for instance, if you wanted to look at issue events:
These are triggered whenever an issue is opened, edited, deleted, transferred, pinned, unpinned, closed, reopened, assigned, unassigned, labeled, unlabeled, milestoned, or demilestoned.
In the payload the sender is defined, and this is the user that performed the action. As these are close to realtime events, you can calculate that the time you receive this is the time the action happened.
The caveat with this is that it doesn’t provide back data, so once you configure - from that moment forwards you will be able to begin using these payloads.