Preferred workflow for getting installation IDs?


It is a truth universally understood that any integration is in want of an installation ID, so that it can authorize itself for the installation and perform useful operations.

Now, maybe I am doing this wrong, but how am I supposed to actually get an installation ID? It is true that if GitHub makes a webhook call to me, I’ll get that information; but in my case, I am building an integration that gets information from somewhere else, and propagates it to GitHub. I know what repo I want to authorize myself to, but as far as I can tell the only way to turn that into an installation id is to query integrations/installations and find the one I want.

Is there a better way?

Get installation ID

Not really; those are the two ways to get installation IDs. Either GitHub tells you with a webhook, and you store it away in a database somewhere, or you ask GitHub with a GET call, and potentially cache it.


Fair enough. In my case, I’m not actually using the webhook functionality of integrations at all; the integration is purely a way of getting a more fine-grained access token than any of the current APIs has. (It’s just a stateless app which posts some data to GitHub’s API.)