question

jishnu avatar image
jishnu asked David Marginian edited

Webhook is triggering 2 times

Hello sir,

I am working with the webhook integration for inventory and found the webhook is triggered 2 times for every change. Is there any way to get only one hit for every change?

Webhooks
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

David Marginian avatar image
David Marginian answered David Marginian edited

Are you listening for both create and update? When are you seeing two hooks trigger (are you adding inventory? Updating inventory? How?).

6 comments
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

For create, update, and delete. If any changes happen in inventory, 2 hooks are triggering with the same request.

0 Likes 0 ·

I am sorry, I can't reproduce this issue. I just set up an inventory webhook in sandbox:

1) When you create an inventory item you will get two webhook messages one will be a create, the other will be an update.

2) When you update an inventory item you will get a single update event.

3) When you delete an inventory item you will get a single delete event.

0 Likes 0 ·
wsadiq avatar image wsadiq David Marginian ♦♦ ·

I am seeing the same issue. For inventory events, the webhook is being triggered twice. The way I have been reproducing is that I go in the inventory app on Clover device and change the quantity of an item. That change triggers the webhook being called twice for the same item.


Can you please help. This is essentially doubling the webhook processing load on our system.

0 Likes 0 ·
Show more comments
rc-luca avatar image
rc-luca answered David Marginian edited

I am also getting two Update events when updating Items. For example, when I change the Price of an Item and click "Save" in my Sandbox account using the website, the below set of events are fired for that App and Merchant:

[{'objectId': 'I:264EBT1ZK9H0E', 'type': 'UPDATE', 'ts': 1614785742570}, {'objectId': 'I:264EBT1ZK9H0E', 'type': 'UPDATE', 'ts': 1614785742687}]

Are we expected to handle these things by discarding all but the last Update? From the previous response it sounds like no, as this should not be happening. Is this a bug?


Regarding Create actions, why are both a Create and Update event sent? This makes it difficult to consume/interpret what is happening because the Update basically needs to be discarded before processing or the same Entity will be processed twice, once for Create and once for Update.


Appreciate any help on these issues.

1 comment
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

I have reproduced the behavior you are describing and in both cases it seems like an issue on our end. I will open up a few tickets so we can investigate this.

1 Like 1 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community