Hello everyone! I am trying to develop a custom app on Node js with the Shopify CLI. The purpose of the app is that of extracting orders daily from the Shopify store, transferring them into a PostgreSQL database. I am currently trying to write code in order to do so but, due to my inexperience in app development, I am finding it hard to understand the whole of it. I am therefore asking you whether you may have any suggestions or advice for setting it up. I already set up the app on a development store (with ngrok etc.) for testing and read the following articles and forum discussions to get some further information: https://shopify.dev/api/admin-graphql/2022-07/objects/order , https://community.shopify.com/c/shopify-apis-and-sdks/api-for-order-export/td-p/842164, however, as of now, I have not managed to achieve much. Could you please help me with that?
Yes, I could. I followed a tutorial on how to select products using the app and everything worked properly. I am wondering how could I use the api to retrieve orders daily. What could I use for making it possible?
Are you using GraphQL or REST API? Is there a reason you aren't using Webhooks instead?
What is your goal once you have the orders and put them into PostgreSQL?
I am using GraphQL and my goal is that of joining the Shopify order data to external order data (from a company software) in order to have better statistics on all of them on a whole
If you only want to get orders moving forward, using Webhooks will probably be easier for you. If you need to go back to get order history you can use the Order object to get orders for any period of time. For example, you may call once a day to get orders for the past 24 hours.
Thanks. I tkink that would work. Are webhooks easy to implement and how could I implement one? I am now struggling a little with requests in general too. It is my first project on this matter.
Yes, Webhooks are pretty straightforward. Best resource is here - https://shopify.dev/api/admin-rest/2022-04/resources/webhook
Yes, webhooks are working here like in Wordpress:
- first you have registered event
- when event happened you can hook it it and call what you need
For example once the order is created than you can call the hook method.