How to register web hook for public app in shophify?

Solved
AkhilKumarTech
Tourist
4 0 0

I have created the public app. I am able to make authorization.
Now i have to register web hook for public app. According to documentation for public app i have to register webhook via  API not via shop admin.

Now the issue is what will be the end URL to post and regiter webhook for order/create. As i know for private app we have to post at shop/admin.
That is https://xxxxxxx.myshopify.com/admin/api/2020-10/webhooks.json

But unable to get URL for Public API POST.
That is what will  be in place of xxxxx in this url for public app https://xxxxxxx.myshopify.com/admin/api/2020-10/webhooks.json



Accepted Solution (1)

Accepted Solutions
Cannesis
Excursionist
19 1 4

This is an accepted solution.

Replies 4 (4)
Cannesis
Excursionist
19 1 4

You can try removing the version and calling /admin/webhooks.json instead

AkhilKumarTech
Tourist
4 0 0

@Cannesis : What should be the URL/domain before ...  /admin/webhooks.json. Is it will be shop URL or something  specific  or common for all shop as we are creating Public app.

Cannesis
Excursionist
19 1 4

This is an accepted solution.

@AkhilKumarTech  Yeah the Shop URL

AkhilKumarTech
Tourist
4 0 0

I have created the webhook successfully.

{
"webhooks": [
{
"id": 964960125084,
"address": "https://test.test.test/drop-servicing/shophify/webhook/create/order",
"topic": "orders/create",
"created_at": "2020-12-22T02:01:57-05:00",
"updated_at": "2020-12-22T02:01:57-05:00",
"format": "json",
"fields": [],
"metafield_namespaces": [],
"api_version": "2020-07",
"private_metafield_namespaces": []
}
]
}

But I am not getting response from my test store webhook, when order is created using test payment gateway.
What could be the reason?