Fetch all orders from a cloud function when a webhook is triggered

WinkyApps
Explorer
50 13 12

We are trying to create a public app which registers a "order create" webhook when it is installed. From then on, whenever a new order is placed at the shop, the webhook trigger on our cloud function (nodejs) will receive the data and fetch other order details for that particular customer (customer id from order webhook).

I did find a sample that explains how to fetch shop data (orders, products) from a cloud function. We would like to generate an access token and call the respective GraphQL APIs. 

When the merchant installs the app, we receive the accessToken at `createShopifyAuth` > `afterAuth` which is binded to the logged in user. Saving this in our external database will limit us to the scope of a staff user since this afterAuth method is called everytime a user logs in and access the app.

Thanks in advance.

Did my answer work for you? Please drop a Like and Mark it as Accepted.
If you need further help or want to get something custom built for your Shopify store, then feel free to mail our team on winkyapps18@gmail.com
Happy to help.
0 Likes