Choose distribution programatically

I am building a tool that helps merchants create custom apps

I am stuck to a point where I cant find anything that can help me do following:

  • Choose Distribution (Custom in my case)
  • And then put merchants link and get install link

Help?

I also trying similar things.
I didn’t find automate option to choose distribution but I found way to generate installation link.

here is an example from node.js

function generateInstallLink(shop, clientId) {

  const redirectUri = encodeURIComponent("https://shopify-dev-tunnel.xubitar.com/api/auth/callback");

const state = crypto.randomUUID(); // save this to verify later


return `https://${shop}/admin/oauth/authorize` +
`?client_id=${clientId}` +
`&scope=${encodeURIComponent("read_products,write_products")}` +
`&redirect_uri=${redirectUri}` +
`&state=${state}`;
}