failure to create CARTS_UPDATE webhook via GraphQL

Solved
Highlighted
Shopify Partner
3 1 0

I am trying to add a CARTS_UPDATE webhook. 

The code used is this : 

 

            const registration = await registerWebhook({
              address: `${EVENTHOST}/webhook/cart/update`,
              topic: 'CARTS_UPDATE',
              accessToken,
              shop,
              apiVersion: ApiVersion.October19
            });
            if (registration.success) {
              console.log('Successfully registered webhook!');
            } else {
              console.log('Failed to register webhook');
              console.dir(registration, { depth: null });

            }

However, the error I get is this : 

 

 {
   success: false,
   result: {
     data: {
       webhookSubscriptionCreate: {
         userErrors: [
           {
             field: [ 'webhookSubscription' ],
             message: 'You cannot create a webhook subscription with the specified topic'
           }
         ],
         webhookSubscription: null
       }
     },
     extensions: {
       cost: {
         requestedQueryCost: 10,
         actualQueryCost: 10,
         throttleStatus: {
           maximumAvailable: 1000,
           currentlyAvailable: 990,
           restoreRate: 50
         }
       }
     }
   }
 }

Any idea why this happens ? I am thinking it could be related to permissions, but there are no obvious permissions in this area. My current permission set is 

 

'read_products', 'write_products','read_script_tags','write_script_tags','read_checkouts', 'write_checkouts'

 

thanks for any pointers or ideas,

Peter

 

 

0 Likes
Highlighted
Shopify Partner
3 1 0

Any ideas on this? If I create a webhook with same code for PRODUCTS_CREATE topic, it works fine.

Is there a list of needed permission values for the different webhook topics?

 

thanks,

Peter

0 Likes

Success.

Shopify Partner
3 1 0

OK - added 

 

'write_orders','read_orders'
 
as scopes. This now works when creating CARTS_CREATE and CARTS_UPDATE webhooks.
 
Is there a place where it is listed what webhooks require which scopes? Also, the error message could be better than just "unable to create webhook"
 
thanks,
Peter
0 Likes