Closed danhanly closed 9 years ago
Hm, I've never had an issue with that, using almost identical code. Can you get the error message body? Sometimes Shopify will return errors.
From https://docs.shopify.com/api/webhook
Trying to create a webhook without an address or topic will return an error
POST /admin/webhooks.json
{
"webhook": {
"body": "foobar"
}
}
Hide Response
HTTP/1.1 422 Unprocessable Entity
{
"errors": {
"topic": [
"can't be blank",
"Invalid topic specified. Topics allowed: orders\/create, orders\/delete, orders\/updated, orders\/paid, orders\/cancelled, orders\/fulfilled, orders\/partially_fulfilled, order_transactions\/create, carts\/create, carts\/update, checkouts\/create, checkouts\/update, checkouts\/delete, refunds\/create, products\/create, products\/update, products\/delete, collections\/create, collections\/update, collections\/delete, customer_groups\/create, customer_groups\/update, customer_groups\/delete, customers\/create, customers\/enable, customers\/disable, customers\/update, customers\/delete, fulfillments\/create, fulfillments\/update, shop\/update, disputes\/create, disputes\/update, app\/uninstalled"
],
"address": [
"can't be blank"
]
}
}
Managed to Dump the full error response and it was because the webhook already existed for that topic/address.
@danhanly How did you manage to dump the full output. I need it on urgent basis.
orders\/create
Localhost won't work as a URL. In my case I was getting an error because I had typo in topic name I was using product/create instead of products/create
This, I'm sure is something to do with the encoding of the webhook data; not being created correctly for JSON.
Following the POST details on this page, I'm getting the 422 Unprocessable Entity error.
I posted to a request bin to see what exactly was getting passed, and the following is the output:
Weird thing is, this looks correct, but Shopify keeps rejecting it.
Code to reproduce: