In a discount function, is it possible to auto create the discount when I install the app

I am using Shopify Remix app development with the Product Discount function extension . It works when I run the GraphQL mutation. Is there any way to create a discount function in the store when the app is installed?

You can do this during install in the Remix template using the afterAuth hook, similar to shop-specific webhook subscriptions: