2017-06-13 133 views
-1

我正在創建一個能夠接收來自許多WooCommerce網站的webhooks的系統。如何從WooCommerce產品CRUD webhook獲取正確的數據?

我還創建了一堆WooCommerce實例,並將它們配置爲在發生產品CRUD操作時webhook地址https://requestb.in/qivtf4qi

然而,在WooCommerce實例的一個執行過的產品的CRUD操作時,網絡掛接內容似乎不正確:

  • 它不包含任何有效載荷,
  • 它不包含任何識別webhook來自哪裏(實例域等)的方式,除了原始服務器IP(如果實例被移動或水平調整,則很不可靠)。

什麼是WooCommerce交付正確 webhook數據的正確方法?

See an example of what gets sent on product update: no way to identify the instance, no content so quite pointless as we would have to query all the products to find out which one was updated

See how each WooCommerce instance is configured to deliver hooks to that single service we're building.

See how the WooCommerce API docs say that the webhook payload should actually carry the resource like if it was modified using the REST API. They also mention a header, X-WC-Webhook-Source, that should contain the source domain.

回答

0

我發現了兩件事情需要(未知來自WooCommerce文檔)用於交付的網絡掛接:

  • 捲曲的PHP擴展有被安裝和啓用。
  • webhooks通過WordPress的cron作業(wp-cron.php)交付,並且在我們的開發環境中沒有設置。

如圖this issue建議的,檢查每個網絡掛接日誌有助於爲好,作爲一個空的日誌建議在像前面描述(CURL /克龍等)的設置有問題。

相關問題