klaviyo / magento2-klaviyo

37 stars 51 forks source link

Adds product/save to message queue #144

Open jordanallain opened 2 years ago

jordanallain commented 2 years ago

This is the next PR in the message queue feature that @siddwarkhedkar and I have been working on. In this PR I add the observer and cron jobs for syncing product data to Klaviyo.

Also in this PR is a new /webhooks endpoint for querying which configurable webhooks are enabled and disabled. For now it is just the product/delete and product/save webhooks.

I also changed the makeWebhookRequest function to accept a json encoded string as its second argument instead of an array. This saves us from needing to call json_encode on the argument three times, the argument was never used as an array in the method. This necessitated me updating the calls to makeWebhookRequest to ensure it always receives a json encoded string as the second argument.