Not able to register webhooks like inventory,draft_order

Not able to register webhooks like inventory,draft_order

ShrutiM
Shopify Partner
15 0 2

Hi,

When I am trying to register webhooks programmaticaly for a merhcant, 

 

requesturl: https://abc.com/admin/api/2020-04/webhooks.json

requestBody:
{
  "webhook": {
    "topic""inventory_items/create",
    "address""my_endpoint_url",
    "format""json"
  }
}
 
I am getting response:
 
{
    "errors": {
        "topic": [
            "Invalid topic specified: inventory_items/create. Topics allowed: app/uninstalled, carts/create, carts/update, checkouts/create, checkouts/delete, checkouts/update, checkouts/paid, collections/create, collections/delete, collections/update, customer_groups/create, customer_groups/delete, customer_groups/update, customers/create, customers/delete, customers/disable, customers/enable, customers/update, order_transactions/create, orders/cancelled, orders/create, orders/delete, orders/edited, orders/fulfilled, orders/paid, orders/partially_fulfilled, orders/updated, products/create, products/delete, products/update, refunds/create, shop/update, tender_transactions/create, app_purchases_one_time/update, app_subscriptions/update, variants/delete, domains/create, domains/update, domains/destroy"
        ]
    }
}
{
    "errors": {
        "topic": [
            "Invalid topic specified: inventory_items/create. Topics allowed: app/uninstalled, carts/create, carts/update, checkouts/create, checkouts/delete, checkouts/update, checkouts/paid, collections/create, collections/delete, collections/update, customer_groups/create, customer_groups/delete, customer_groups/update, customers/create, customers/delete, customers/disable, customers/enable, customers/update, order_transactions/create, orders/cancelled, orders/create, orders/delete, orders/edited, orders/fulfilled, orders/paid, orders/partially_fulfilled, orders/updated, products/create, products/delete, products/update, refunds/create, shop/update, tender_transactions/create, app_purchases_one_time/update, app_subscriptions/update, variants/delete, domains/create, domains/update, domains/destroy"
        ]
    }
}
 
 
This behavior is coming for webhooks: 
inventory_levels/create,inventory_levels/update,inventory_levels/delete,inventory_items/create
inventory_items/update,inventory_items/delete,draft_orders/create, draft_orders/update,draft_orders/delete
But these webhooks i can register from admin console.
 
But for other webhooks it is working fine
 
Kindly help me if I am doing anything wrong while registering webhooks

 

Replies 3 (3)

Jivan_Suhagiya
Shopify Partner
595 82 127

Hi,
As per my understanding, you're missing scope for that

If helpful then please Like and Accept Solution.
Email: [email protected]
Skype: jivan.suhagiya
First kind of Checkout Reminder APP: https://apps.shopify.com/checkout-reminder
ShrutiM
Shopify Partner
15 0 2

Hi Jivan,

 

If I am not wrong by scope you mean "read access" or "read and write access". How can I set scope while registering webhooks using https request?

_JB
Shopify Staff (Retired)
836 100 223

Hey @ShrutiM,

You need to request the scopes before creating a webhook. If you're using a private app, the scopes are chosen when you create the API credentials on the Admin > Apps > Private Apps page. If you're using a public app, the scopes are requested during the installation process using Oauth. Once your app has the necessary scopes, you should be able to create those webhooks.

JB | Solutions Engineer @ Shopify 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog