leofuturer / eDrops3

The 3rd generation of the eDrops web application.
MIT License
0 stars 0 forks source link

Setup automatic ngrok webhook #104

Closed Kenny477 closed 1 year ago

Kenny477 commented 1 year ago

Currently we have to manually go into the Shopify dashboard -> Notifications to add the ngrok address in order for webhooks to work and to test order lifecycle issues.

I already wrote a small library in server/ngrok.ts that enables the creation and deletion of Shopify webhooks through the Shopify Admin API, however to do this automatically we need to do some investigation into how to integrate this with the docker lifecycle, or perhaps just do it on Loopback server start.

And also the issue of cleaning up added webhook addresses after the server is shut down. The best way to handle this hopefully is by looking into Loopback lifecycle and seeing if there is something like an on shutdown event to clear webhooks.

Lastly note: webhooks added through the Admin API do not show up in the dashboard. However, they can be retrieved/listed through the Admin API so you can double check which webhook addresses are active.