What is the difference between installation.created and installation_repositories.added

I am just starting out on developing my first GitHub app and I am not sure if I understand the use of the installation resource yet. My main concern now is that I am unable to understand the difference between the installation and the installation_repositories webhooks. When are they triggered and do I need to handle these events differently?

Hey, hey @sayakmukhopadhyay!

Been a while on this post, but I’m going back through the API category for unanswered topics and didn’t want to let this slip through. It’s entirely possible you’ve already found your answer, but if anyone else comes looking, our docs speak to the differences.

For installation:

https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#installation

Activity related to a GitHub App installation. The type of activity is specified in the action property of the payload object.

…and note:

Note: This event replaces an event that will be deprecated. When you subscribe to this event, you will also receive the deprecated event integration_installation until it’s permanently removed. If you’re writing or updating API client code, use the installation event. The event contain the same information as the deprecated event.

Then, for installation_repositories:

https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#installation_repositories

Activity related to repositories being added to a GitHub App installation. The type of activity is specified in the action property of the payload object.

…and note:

Note: This event replaces an event that will be deprecated. When you subscribe to this event, you will also receive the deprecated event integration_installation_repositories until it’s permanently removed. If you’re writing or updating API client code, use the installation_repositories event. The event contain the same information as the deprecated event.


I’ve merely quoted our docs here, so please do let us know if there’s any remaining confusion! It’s possible our docs could do with some pruning and feedback is certainly welcome.

Thanks for jumping in. My main concern was knowing when exactly are these events triggered. Things like if one of the events can be triggered without the other Some examples would go a long way in understanding. Use cases and such.

Hey @sayakmukhopadhyay apologies; yes, you did ask about the when, not just the differences between them!

So installation is related to events when your app is installed on an Org, or Repository. Since an install can happen at the Org level for all, or specific repositories, you might not get a subsequent webhook triggered on a repository within an Org where all repositories are selected.

For installation_repositories, the webhook is there for those specific repositories that install your app. So say on the initial installation to an Org where they apply it to all repositories, you would only see the install event for the Org, but then you would see subsequent installation_repositories events, when new repositories are added to that Org, which then include your app as part of the creation process.

I really hope that helps clear up what the docs mean, but let us know if you have any more questions!

1 Like