Push Shopify Order to ERP System in Real Time

Wolf7967
Tourist
7 0 0

Hi Gurus,

     I am basically a NetSuite Developer and is new to Shopify. One of our clients is planning to open a Shopify Store and want to integrate with their NetSuite ERP System. I had looked at the Shopify API Documentation and it seems we can use REST API Services for our Integration. While I got a fair bit of an idea on how we can push data (Products/ Inventory details etc.) from the ERP system to Shopify, I don't have much idea on how we can push data from Shopify to the ERP system in real time. For Eg Whenever a customer places an order in Shopify, a sales order needs to be created in the ERP System in real time. Another one will be to update Inventory Stock levels in real time from Shopify to NetSuite.      

Would any of you guys throw some light on how this can be achieved? Should we create an app in Shopify that pushes the data to the ERP? 

We looked at the option of pulling the data from Shopify (through REST API), but this will be a significant overhead in the ERP system as we may need to create a recurring scheduled job trying to pull the data from Shopify every 15 minutes or so. Also it will not be a real time update. So this will be the last option.

NB: Please note that we are planning to develop this integration on our own and not planning to use any middleware or app. 

Thanks in advance!

0 Likes
Anto_S
Excursionist
26 0 4

Hi @Wolf7967 

You can create a webhook under Settings>Notifications>Webhooks>Create a webhook. However, this will not cover situations where there are timeouts - no retries, so there is a possibility some orders may be missed. 

thanks

Anto

marcusradica
Shopify Staff
Shopify Staff
41 5 6

Just to clear this up, webhooks do retry. If an app times out when responding to a webhook, the webhook will retry up to 19 times over a 2 day period. More information is under "responding to a webhook" in this link https://shopify.dev/tutorials/manage-webhooks 

marcusradica | Developer @ Shopify 
 - Was my reply helpful? Click Like to let me 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

Wolf7967
Tourist
7 0 0

Thanks for the suggestions @Anto_S @marcusradica .  Really appreciate it.

0 Likes
_JB
Shopify Staff
Shopify Staff
822 97 178

Hey @Wolf7967,

Webhooks will be the best bet here. They're near real-time (a few seconds in most cases), and Shopify automatically retries failed webhook deliveries if your endpoint doesn't respond. This approach allows Shopify to do most of the heavy lifting. 

When using webhooks we recommend implementing a periodic job to ensure your app has been notified of all newly created resources, in the extremely rare event Shopify doesn't fire a webhook. This can be a once a day job that pulls all new resource ids from the last day to compare to webhooks you received. This is almost not worth mentioning as it rarely ever happens, but for data integrity purposes it's still a recommendation.

JB | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me 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

0 Likes
CourtneyMiller
Excursionist
37 1 2

Hi @Wolf7967, I'm also interested in how you're planning to integrate with Netsuite. How come you are not planning to use a middleware or existing Netsuite integration solution? Are you planning to build something in Heroku yourself?

0 Likes
Wolf7967
Tourist
7 0 0

Hi @CourtneyMiller , We are still in the design phase and looks like there is some challenges to achieve this. Will see how it goes.

0 Likes
Wolf7967
Tourist
7 0 0

Hi @_JB , @marcusradica , @Anto_S ,  Thank you gurus for the inputs. I am trying to use the webhooks but it seems there is a challenge in that. The message triggered by the webhooks gets ignored by NetSuite and it never reaches the end point url (Suitelet). On researching I found that this is caused by the "User-Agent" header value in the message. Shopify sets this as "ruby" and it seems the ERP doesn't like it and rejects that. They accepts only if the User-Agent is set to a web browser. Is there a way we can change this setting in Shopify Webhooks?

 

Thanks.  

0 Likes
Anto_S
Excursionist
26 0 4

Hi @Wolf7967 

You can resolve this with an intermediary server that receives the request and resets the user agent to a browser so it hits your suitelet. I dont believe you can modify the webhook on Shopify. Happy to discuss, email me at anto@opstack.co.

thanks

Anto

Wolf7967
Tourist
7 0 0

Hi @Anto_S , Thank you for the suggestion. I am able to resolve it and the webhook request is hitting the suitelet now. I was following the shopify documentation for the hmac_sha256 signature verification and is trying to do the verification in NetSuite but it seems the signature generated from the suitelet suitescript is always different from the one sent by the Shopify. Do you have any suggestions on this? Would that be because the webhooks are forwarded from the intermediary  server?

Appreciate your help .

0 Likes