How long does it take for a webhook to fire?

Highlighted
Shopify Partner
22 0 2

I've been testing webhooks on our development store, and I registered for the carts/create and checkouts/create topics.  When I went to our development store, I clicked to add a product to the cart, then clicked to checkout.  I checked the logs for our webhook, and saw no logging (it hadn't been called).  I thought it wasn't working since I saw no logging.  however, the next day, I saw the log events had fired a day later.  I believe it was roughly 12 hours or so later after actually clicked to add to the cart and checking out.

 

I've tried a couple more times, and that seems to be the case.  Does anyone know how long it is supposed to take for an event to trigger a call to your registered endpoint?  That is, if a person clicks to checkout, and you've registered a webhook to receive that event, is it supposed to be fired within seconds of someone clicking to checkout, or is it customary for it to take hours?  Or is this just a development store quirk?

 

Just FYI: I know the webhook logs immediately when invoked, because when I call it in Postman, it logs right away.

0 Likes
Highlighted

Hello 

 

<?php
define('SHOPIFY_APP_SECRET', '#########################');

function verify_webhook($data, $hmac_header)
{
$calculated_hmac = base64_encode(hash_hmac('sha256', $data, SHOPIFY_APP_SECRET, true));
return hash_equals($hmac_header, $calculated_hmac);
}

 

 

 

Want to modify or incorporate custom changes on store, Hire us
If helpful then please Like and Accept Solution .
Email: pallavi@oscprofessionals.com
Skype : oscprofessionals-87
Whats app
Free Website Review and advice for sale from Shopify Conversion Experts | Shopify Private App | Custom Theme Development | Custom Modifications In To Shopify Theme | Shopify SEO ; Digital Marketing & amp | Site Speed Optimization | Performance Site Audit
0 Likes
Highlighted
Shopify Partner
22 0 2

Thanks for the response.  I will take a look at those steps and verify.  We have an Amazon cert, so I assume that is good.  But I do not believe we are checking the HMAC.  Though, why would the HMAC not be valid for an actual shopify call?

0 Likes
Highlighted
Shopify Expert
9925 103 1762

It is possible for a webhook to be delayed so the comment above about them firing instantly is incorrect. That said, I would not expect the delay you're seeing.

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
1 Like
Highlighted
Tourist
8 0 3

In my case, the app/uninstall webhook is triggered after more than 2 minutes after the app is uninstalled from the shopify store.

Because of this, my app fails app review every time because the app doesn't know when to reset the session and this will lead to failure when trying to reinstall.

0 Likes