Solved

Integrate NetSuite using Webhook

sh_netsuite
Shopify Partner
3 0 0

Hi,
I have created a Suitelet in NetSuite to get data from shopify, and created a webhook for Order_creation event in that I have used external URL or suitelet, which will get called when any order will be created in Shopify account.
But it is not working; I have tried several times, but didn't receive any data on the endpoint (external URL for suitelet).

Important thing, the used external URL (for suitelet) is working properly when it's done using Postman
- GET Method
https://imgur.com/a/8WYX0Wq
- POST Method
https://imgur.com/a/GH5Nttj

I need your guidance.

Accepted Solution (1)
Gregarican
Shopify Partner
1033 86 285

This is an accepted solution.

As far as I'm aware I don't think you can modify the POST headers that the Shopify webhook is firing over. One idea would be to implement a thin web service in the cloud somewhere (e.g. - Amazon, Azure, etc.). It would accept the Shopify webhook, validate the HMAC signature, parse the JSON body details, and then forward the data along to NetSuite so that the request follows the exact format that NetSuite is looking for. It really wouldn't take a great deal of effort. I know it's a workaround, but if Netsuite won't accept what Shopify is presumably sending then it's an idea.

What if you change the destination of the webhook to a resource that you control? Can you see that there is data being sent to it? Any sort of web service logging on the recipient end would at least see the traffic...

View solution in original post

Replies 7 (7)

Gregarican
Shopify Partner
1033 86 285

So you didn't receive any web requests at all? If so, I'd recommend checking the way the webhook is defined in Shopify. If your receiver just wasn't able to parse things, then check that the receiver is configured to parse a JSON request body as detailed for orders/create here --> https://shopify.dev/docs/admin-api/rest/reference/events/webhook.  

sh_netsuite
Shopify Partner
3 0 0

Hi, Greg

Thanks for your reply

The problem is not parsing JSON data in the receiver.
The issue is that the JSON data was not reached to the endpoint url at all.
I think Shopify send JSON data based on POST method to the targeted endpoint url.
But for the endpoint url for NetSuite suitelet script, Shopify fails to send JSON data.

Is it possible to customize the Shopify webhook to add some additional HTTP headers for endpoint url (NetSuite suitelet)?
Here's those HTTP headers to be added and in that case, there would be no problem
https://imgur.com/a/GH5Nttj  

Gregarican
Shopify Partner
1033 86 285

This is an accepted solution.

As far as I'm aware I don't think you can modify the POST headers that the Shopify webhook is firing over. One idea would be to implement a thin web service in the cloud somewhere (e.g. - Amazon, Azure, etc.). It would accept the Shopify webhook, validate the HMAC signature, parse the JSON body details, and then forward the data along to NetSuite so that the request follows the exact format that NetSuite is looking for. It really wouldn't take a great deal of effort. I know it's a workaround, but if Netsuite won't accept what Shopify is presumably sending then it's an idea.

What if you change the destination of the webhook to a resource that you control? Can you see that there is data being sent to it? Any sort of web service logging on the recipient end would at least see the traffic...

Shayne
Shopify Staff
253 19 64

As far as I'm aware I don't think you can modify the POST headers that the Shopify webhook is firing over.

This is correct. Pretty much everything that Greg said is right on the money, so I marked his response as the solution.

 

Shayne | Developer Advocate @ 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

sh_netsuite
Shopify Partner
3 0 0

Thanks for your reply.

Michael_crioxen
Visitor
1 0 0

Can I add a cookie parameter to my webhook?

Shayne
Shopify Staff
253 19 64

Currently, it's not possible to add any parameters to webhooks.

Shayne | Developer Advocate @ 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