Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Feature/webhooks graphql support #796

Closed

Conversation

onurkose
Copy link
Contributor

Hello!
I needed to subscribe to app_subscriptions/update webhook, and it only supports GraphQL.
I've made the necessary changes to implement GraphQL support to webhooks CRUD ops.

Thanks for the great package btw.

gnikyt added 30 commits April 7, 2021 13:42
* Combining AuthShopify, AuthToken into new VerifyShopify middleware
* SessionToken value object created to verify and validate all aspects of the JWT
* New unauthenticated route and view added
* VerifyShopify: Cleaned up methods to be smaller and clearer
* VerifyShopify: Handle cases for no token, no hmac
* VerifyShopify: Adjusted to not rely on ShopSession service anymore.
* Moved AuthorizeShop to InstallShop
* Condensed InstallShop and modified to return an array
* Modified InstallShop to track access token update time
* Modified Shop command to track access token update time
* Removed authenticate.oauth route
* Removed oauthfailure method on authenticate controller
* Removed ShopSession class
* Updated shopify-config to reference new authenticate routes (install, token)
* Updated shopify-config to remove old authenticate routes
* Updated ShopModel's getToken to getAccessToken for naming conflict purposes
* Removed old ITP and authenticate routes from built-in route provider
@gnikyt gnikyt self-assigned this Jun 14, 2021
@gnikyt gnikyt added the feature Enhancement to the code label Jun 14, 2021
@gnikyt
Copy link
Owner

gnikyt commented Jun 21, 2021

Looks fine, is there any breaking changes you noticed? Or are webhooks running as normal?

@onurkose
Copy link
Contributor Author

There's only one breaking change;

Webhook definitions is currently like this:

[
    'topic' => env('SHOPIFY_WEBHOOK_1_TOPIC', 'orders/create'),
    'address' => env('SHOPIFY_WEBHOOK_1_ADDRESS', 'https://some-app.com/webhook/orders-create'),
]

GraphQL API requires topics as depicted in this list:
https://shopify.dev/docs/admin-api/graphql/reference/events/webhooksubscriptiontopic

And that makes the new definitions should be:

[
    'topic' => env('SHOPIFY_WEBHOOK_1_TOPIC', 'ORDERS_CREATE'),
    'address' => env('SHOPIFY_WEBHOOK_1_ADDRESS', 'https://some-app.com/webhook/orders-create'),
], [
    'topic' => env('SHOPIFY_WEBHOOK_2_TOPIC', 'APP_PURCHASES_ONE_TIME_UPDATE'),
    'address' => env('SHOPIFY_WEBHOOK_2_ADDRESS', 'https://some-app.com/webhook/purchase'),
]

@gnikyt
Copy link
Owner

gnikyt commented Jun 22, 2021

@onurkose Ah! Can you update config/shopify-app.php to reflect this? Thanks! Should be good to merge then if you're seeing no functional issues.

@ncpope
Copy link
Contributor

ncpope commented Jun 22, 2021

This is helpful, thanks for creating this pull request @onurkose

@onurkose
Copy link
Contributor Author

@onurkose Ah! Can you update config/shopify-app.php to reflect this? Thanks! Should be good to merge then if you're seeing no functional issues.

It's done!

Yes, we are using a forked-version of this one on production right now and no issues at all.

@onurkose onurkose closed this Jun 25, 2021
@onurkose onurkose deleted the feature/webhooks-graphql-support branch June 25, 2021 10:58
@gnikyt
Copy link
Owner

gnikyt commented Jun 25, 2021

@onurkose why the close?

@onurkose
Copy link
Contributor Author

I had (mistakenly) cookieless branch merged&pushed over this one, tried to reset the branch but couldn't succeed it without deleting the origin/remote. When I deleted the remote branch github closed the pr itself. Here is the new one.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature Enhancement to the code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants