Inventory webhook not being called

Hello,

I’m trying to use the inventory update webhook but it doesn’t seem to be triggered at all when I change the “on hand” value of a product.

I registered the webhook using a webhook_create mutation, and verified that it is correctly registered by querying it, here are the details I get back from the api:
{ id: "QXBpV2ViaG9vazoxNjE3NzY5", legacy_id: 1617769, account_id: "QWNjb3VudDo1OTc0MQ==",shop_name: null, name: "INVENTORY_UPDATE", url: "https://81fd9a501b56.ngrok.io/module/max_shiphero/webhook", source: "api"}

I’m using ngrok to be able to test the webhook locally so the url here is temporary but I tested it several times and it works fine (I even saw a request coming through when pasting the json above in this editor), but still I don’t get any webhook request, is my configuration ok ?

Thanks in advance,
Max

Ok found the issue, my mistake was on the name field I was using the webhook “type” INVENTORY_UPDATE instead of using the exact string Inventory Update, which is the webhook “name”

Hi @Max!
I’m glad you were able to found it.
Please let me know if there is anything else we could help with!
Tom

Hi @tomasw ,

Yes thank you ! I have a few other questions regarding webhooks, as I am testing a little further I’m noticing a delay between a manual inventory change in the web app and the webhook request effectively being made. Sometimes there is little to no delay, but others it can be quite consequent (like 5 minutes or so), which means the stock in the shop won’t be up to date for a relatively long period of time. Is it an expected behaviour ?
Also, is there a way to differentiate a “manual” inventory change and an automatic one, like when an order is shipped, I see there is a “reason” field for a stock change but this info does not seem to be available in the webhook data.

Thanks in advance for your support !
Max

Hi @Max!

Webhook notifications are intended to be triggered within 5 minutes. If an account makes a huge amount of changes then it might accumulate and take longer

We don’t currently display it on the webhook. If you want I could make a request for this to be added

Let me know if that would work for you.
Thanks again!
Tom

Hi @tomasw

Thanks for your response. Yes it would be great to have this information on the webhook, because as it is right now I don’t really see how we can keep our shop stock synced with shiphero inventory:

  • If we let only the webhooks manage the stock, we’ll have those delays and a customer could potentially order a product that’s been out of stock for 5 minutes or more but not synced yet.

  • If our shop keeps updating stock when new orders are made, we won’t be able to differentiate if an “INVENTORY_UPDATE” webhook call is coming from an order (where the stock has already been decremented) or from a manual update. We also loose the ability to let shiphero handle kit stocks.

  • We could also check product stocks in real time with api calls, but we would quickly hit throttling problems and that would surely be a performance bottleneck.

Do you have any advice / use case about this particular issue ?

(Also, unrelated to this problem, but I’m having difficulties to make some orders created via the api show up in the app. I’ll create another topic to not overload this one !)

Thanks in advance for your help !
Max

Any update on this issue ? Sadly it’s a dealbreaker for us…

Thanks,
Max

Hi @Max!
I apologize for the delayed response about this.
Unfortunately, I don’t have an answer yet about this, but I will try to see if I can get a response back asap.

Although it is not often, it is possible for a webhook not to fire, and that is why we don’t encourage you to rely just on receiving data from our webhooks, so implementing reconciliation jobs to periodically fetch data from ShipHero is strongly recommended.
Our most important Queries have both the created_at and updated_at filter parameters, which will allow you to build a job that fetches all resources that have been created or updated since the last time the job ran.

The value send on the webhook after that order allocates is the Available, so for the situation mentioned above, the number should always match what is already available in your shop.
Unless you manually edit inventory on your shop, which will cause a discrepancy between your available stock in your shop and in ShipHero.
We will be also adding the On Hand quantity soon to the webhook, so you can differentiate both.

Sounds good! If you are looking for reconciliation jobs maybe you could check our Inventory Snapshot which will also contain Available quantities soon.

I will let you know as soon as I have more updates about this.
Thanks again for the patience!
Tom

The only restriction I might think of is, for example, 10 orders come in from the store at the same time, then the reason will only display that last order because we will be sending the -10 new available