State of GraphQL Admin Api

Shopify Partner
4 0 1

Hi all,

I noticed that GraphQL admin api is very unstable and certain things are simply not possible. For example, if try to create a webhook with topic PRODUCTS_CREATE it works fine but ORDERS_CREATE doesn't although with the same set of access scopes I CAN do so via REST api.

Now I know it is in Beta but that usually implies that most of the functionality is there and I don't understand why those webhook registrations would fail.

Anybody has thoughts on that?

Is it too early to develop with GraphQL admin api?

1 Like
Shopify Staff
Shopify Staff
1289 43 187

You're going to have to be more clear about what you mean when you say unstable, to address your first statement.

Regarding ORDERS_CREATE webhooks: I seem to be able to create these just fine. Can you provide more information? What does your query look like, what scopes do you have exactly, etc.

Cheers.

0 Likes
Shopify Partner
4 0 1

Hi Alex!

Sure, here's what I'm doing (very basic stuff taken directly (almost) from examples on shopify website).

Access scopes I have:

['read_products', 'write_products', 'read_themes', 'write_themes', 'read_checkouts', 'read_orders']

Mutation:

mutation webhookSubscriptionCreate($topic: WebhookSubscriptionTopic!, $webhookSubscription: WebhookSubscriptionInput!) {
  webhookSubscriptionCreate(topic: $topic, webhookSubscription: $webhookSubscription) {
    userErrors {
      field
      message
    }
    webhookSubscription {
      id
    }
  }
}

Variables for mutation:

{
            "topic": "ORDERS_CREATE",
            "webhookSubscription": {
                "callbackUrl": `<myHost>/webhooks/order-created`
            }
        }

Response I get:

"webhookSubscriptionCreate": {
        "userErrors": [
          {
            "field": [
              "webhookSubscription"
            ],
            "message": "You cannot create a webhook subscription with the specified topic",
            "__typename": "UserError"
          }
        ],
        "webhookSubscription": null,
        "__typename": "WebhookSubscriptionCreatePayload"
      }

As I mentioned earlied, PRODUCTS_CREATE works fine with that setup and switching to REST api works for both topics just fine.

0 Likes
Shopify Staff
Shopify Staff
1289 43 187

Thanks so much for the details! There definitely appears to be an inconsistency here. I'll raise this issue with the platform developers and I'll let you know what direction we're going to take. In my opinion, read_orders should be all you need.

Cheers and stay tuned.

0 Likes
Shopify Staff
Shopify Staff
1289 43 187

Just stopping by to confirm we have determined this to be an issue and are investigating. When a fix rolls out I'll let you know. In the mean time, write_orders will get you the permissions you need if you need to use GraphQL, or a REST call with read_orders will work too (for any others joining the conversation).

Cheers.

0 Likes
Shopify Partner
4 0 1

Ok, sounds good!

Thank you for looking into this so quickly!

0 Likes
Tourist
5 0 3

I'd just like to point out that this is still an issue and tripped me up. It would be nice to at least have the bug documented somewhere. In fact, I was looking for a place where scopes are mapped to webhook topics and couldn't find one, which would also be helpful.

1 Like
Shopify Partner
3 0 0

Just came here to say that I also encountered this issue. Workaround described fixed it. But please keep us updated when a fix is released since I don't want to ask for more permissions than I have to.

0 Likes
Shopify Partner
1 0 0

I too have exact same issue . I do have read_order permission but can't create grpahql webhook for 'ORDERS_CREATE'. 

0 Likes
Highlighted
New Member
1 0 0

This issue is still present for `CUSTOMER_CREATE` and `CUSTOMER_UPDATE` topic. You need the `write_customers` permission to be able to register a webhook. It does not make any sense, `read_customers` should be enough.

0 Likes