Zoho Webhooks & Shopify API: Keep Disappearing
- Joel Lipman
- Zoho
- Hits: 125
This is an article to show how to setup a scheduled function that checks and restores a missing webhook as well as the snippets when receiving the webhooks and storing them.
Why?
We found that Shopify would intermittently remove our webhooks. This would make the entire synchronization of the system go out of whack and some records would slip through the net while every day, the process to tidy these all up would leave the data more and more unreliable.
So Shopify want your webhooks to respond within 1 second. This is about enough time to store the record but that's it. Processing the record must be done at a later time or in a different process but sometimes it simply will not process it all and respond to Shopify within 1 second.
How?
So let's begin with the code snippets as these might answer your question to begin with and then we'll do the easy bit on how you set this up in the CRM. I'm using ZohoCRM here despite storing the record in ZohoCreator as the app and data processing is mostly done in ZohoCreator. I could have setup webhooks to go directly to Zoho Creator but I don't find Zoho Creator reliable when receiving and responding to webhooks.
Important!: For the REST API to detect what webhooks exist, it can only detect what webhooks it initialized. If you added webhooks via another app or via the Shopify Admin interface, then the following code won't be able to check and restore them.