Topics covering webhook creation & management, event handling, Pub/Sub, and Eventbridge, in Shopify apps.
Hi everyone, first time poster here. I've got a lot working with the API with no problems, but I need to register a webhook, and keep getting the "Required parameter missing or invalid" error. I've followed all of the instructions, but maybe I've missed something.
URL: https://bil-test-store.myshopify.com/admin/webhooks.json
Method: POST
Headers: Content-Type: application/json
X-Shopify-Access-Token: mytokengoeshere
Body:
(Body content type application/json)
{"webhooks":
{
"topic": "products/update",
"address": "https://mysite.co/hooks/shopify/products/update",
"format": "json"
}
}
I can validate that the token is good, as if I change anything there I first get the error of invalid token, so it's something with a missing parameter...buy I have NO idea what I am missing. I googled around here and stackoverflow and have found no substantive answers. Any clues on what's missing??
It looks like you have `webhook` pluralized at the top level. You're meant to be creating a single webhook, not an array of them. In this case, `webhook` is the missing or invalid required parameter.
Alex | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
Thank you very much !
The code to successfully create a webhook in WordPress using the Shopify REST ADMIN API is as follows:
Ha, how did I miss that? That worked. Thank you. Hangs head in shame, walks away.
I'm actually getting this as well - but not on all stores, only some... can't seem to create any webhook associations - and also injecting script tags- but let's start with this first...
{"webhook":{"topic":"customers\/create","address":"https:\/\/our_site.com\/hooks\/DYNAMIC_ID\/customers\/created","format":"json"}}
response from shopify:
{"errors":{"webhook":"Required parameter missing or invalid"}}
Is there any way to get some help on this?
@shopify - just in case you needed a ping for the above ^^
Hey there.
Can you share an x-request-id I can look at? You'll have received one in the response headers.
Alex | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit the Shopify Help Center or the Shopify Blog
Hey Alex, thanks for responding. I was able to figure this out yesterday late... it had to do with me making requests to the actual store domain, not the 'secure_url' and the redirects not working correctly with CURL... so I think the key is to make sure that the secure url is being used at all times, not the domain.
That would be pretty accurate right?
Hi All
I just want to add, that i had the same problem, and solved it by setting adequate content Content-Type
Here is the code for PHP
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$post_web_hook);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Accept: application/json",
"Content-Type: application/json"
));