Solved

Need to receive Webhook JSON data to parse and load to mysql

Vandy135
Visitor
1 0 0

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? 

Accepted Solution (1)

ShopifyDevSup
Shopify Staff
1453 238 498

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

View solution in original post

Replies 2 (2)

ShopifyDevSup
Shopify Staff
1453 238 498

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

GustavoTofolo
Tourist
10 0 2

Hi @Vandy135 , were you able to verify the integrity of your webhook?