Building a github app and I am trying to figure out how to configure webhooks for the installed app through the API. In the documentation two methods of settings up webhooks are mentioned. One is where the webhooks are set up against a specific repository. This seems cumbersome since installing users would in most cases be intrested in several repositories at once (in my use case). Taking this approach would require me to register hooks for all repositories the user has access to (and update the hook registrations whenever a user gets access to additional repositories)
The second approach mentioned is to register webhooks against an organization. But this seems to require the app to be installed on an organization. What happens if the app is installed on a personal account and not a organization. Im I then forced to register webhooks for each repository the user has access to individually?
Some of the webhooks events are for installations and purchases (e.g. marketplace_purchase, installation_repositories) These events does not seem to be tied to an individual repository. How can I subscribe to them when the app has been installed on a Personal Accountif I am forced to apply hooks on indiviual repositories?
Thank you for your help!
If you're building a GitHub App you don't have to register webhooks on a case-by-case basis at all. The instructions for registering webhooks through the API is for older-style OAuth applications.
When you create a GitHub App, you configure it to receive certain events. These events are essentially webhooks but don't need to be "registered" as such. If someone installs your GitHub app on their personal or organization account and grants your app access to one or more repositories, your app will begin receiving the events that you specified for those repositories without you having to do anything additional.
I hope that helps!