woocommerce / wc-api-ruby

A Ruby wrapper for the WooCommerce API.
MIT License
69 stars 74 forks source link

Using webhook with legacy V2 #26

Closed bonol closed 8 years ago

bonol commented 8 years ago

I am trying to use webhook to listen to to webhook action and update product stock amount/price, delete product and create new product accordingly on my app. The woocommerce store is using Version 2.2.4, which webhook can not be created on the wordpress portal (correct me if I am wrong, I can't find it anyway) So I try to create webhooks via API.

I tried the example on documentation, the get actions work and the webhook count is zero. That's correct because I haven't any so far. Then I try on the post action to create my own: data = {webhook: {name: "Add to cart webhook", secret: "randomsecrectstring", topic: "action.woocommerce_add_to_cart",delivery_url: "http://requestb.in/1exdwip1" } } woo_store.post("webhooks", data)
The response is code 500 as below: {"errors"=>[{"code"=>"woocommerce_api_cannot_create_webhook", "message"=>"Cannot create webhook: 0"}]}

I know the delivery url won't work, but this should at least create a webhook. Any idea which part goes wrong? Thanks!

claudiosanches commented 8 years ago

This wrapper support legacy V2. But seems like you need to read the docs: https://woothemes.github.io/woocommerce-rest-api-docs/v2.html

And note that here is not a support channel for the REST API. You this GitHub only to report problems with this wrapper (something that is not your case).