Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
Hi community,
Thank you in advance for any guidance. I have code that parses the get orders/create api parse the JSON data in Python and loads it to a MySQL database. I know the Webhook functionality is more efficient than polling however, I’m not very familiar with Webhooks.
What is the best processes to use in order to receive the Webhook in Python and then run my code?
Solved! Go to the solution
This is an accepted solution.
Hey @Vandy135 - this is a great question. You are correct that webhook subscriptions are usually considered more efficient than polling - and they're also great for building triggers for actions within your app's logic. We still recommend that you build polling into your app as a backup as webhook delivery isn't always guaranteed, but for the most part it can be pretty reliable.
We're generally unable to help with code-level solutions on the forum (outside of our own APIs/Libraries), but a popular way some folks set up webhook endpoints/listening services in Python is to use a framework like Flask or Django to handle receiving the webhook. You could then build a callback function for the webhook endpoint to parse the JSON data and send it to your database.
I did a bit of digging and found this article here from LogRocket that has some steps that may help get you started. Hope this helps!
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
This is an accepted solution.
Hey @Vandy135 - this is a great question. You are correct that webhook subscriptions are usually considered more efficient than polling - and they're also great for building triggers for actions within your app's logic. We still recommend that you build polling into your app as a backup as webhook delivery isn't always guaranteed, but for the most part it can be pretty reliable.
We're generally unable to help with code-level solutions on the forum (outside of our own APIs/Libraries), but a popular way some folks set up webhook endpoints/listening services in Python is to use a framework like Flask or Django to handle receiving the webhook. You could then build a callback function for the webhook endpoint to parse the JSON data and send it to your database.
I did a bit of digging and found this article here from LogRocket that has some steps that may help get you started. Hope this helps!
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog