gnikyt / laravel-shopify

A full-featured Laravel package for aiding in Shopify App development
MIT License
1.24k stars 374 forks source link

Shopify AWS EventBridge for Webhook #1113

Open veed76 opened 2 years ago

veed76 commented 2 years ago

Hi @osiset @Kyon147 @lucasmichot

I'm registering the webhook via AWS EventBridge, I have added the ARN for the webhook address. Example:

'webhooks' => [
         [
            'topic' => 'app/uninstalled',
            'address' => "arn:aws:events:eu-west-2::event-source/aws.partner/shopify.com/9999999/staging-event-bus"
        ],
],

While I'm installing the app in the Shopify store, I got this error: https://prnt.sc/8KxBgePrZSFC

Can you please check and let me where I'm wrong?

Thank you.

Kyon147 commented 2 years ago

Hi @veed76

I can't say much for your AWS set up but that does not look like a proper qualified url.

The error says what the issue is Invalid URL so I believe that is your problem.

veed76 commented 2 years ago

Thanks @Kyon147 for reply. just want to know in this package is it possible to pass AWS ARN in webhook Address?

Kyon147 commented 2 years ago

Thanks @Kyon147 for reply. just want to know in this package is it possible to pass AWS ARN in webhook Address?

The webhook needs to be a URL, it's not a requirement of the package but a requirement of Shopify when setting up webhooks using the API.

Here's the docs

veed76 commented 2 years ago

In shopify Documentation they mentioned that we can pass ARN

https://shopify.dev/apps/webhooks/configuration/eventbridge#define-a-custom-event-pattern

image

veed76 commented 2 years ago

I just registered via POSTMAN and it works with AWS ARN image

veed76 commented 2 years ago

There is a support for webhookSubscriptionCreate. I check in osiste/Laravel Package and there is no support for eventBridgeWebhookSubscriptionCreate GraphQL.

lucasmichot commented 2 years ago

There is a support for webhookSubscriptionCreate. I check in osiste/Laravel Package and there is no support for eventBridgeWebhookSubscriptionCreate GraphQL.

Hi @veed76 , indeed there is no support. Feel free to make a PR or just ask a Shopify developer to do it

Kyon147 commented 2 years ago

Interesting, good testing - it looks like webhookSubscriptionCreate uses type URL https://shopify.dev/api/admin-graphql/2022-01/scalars/URL

Which is why eventBridgeWebhookSubscriptionCreate exists to be able to use the ARN routes.

As @lucasmichot mentions - the package does not have that GraphQL support in it, as you've found yourself. So feel free to provide a PR.

veed76 commented 2 years ago

Hi @lucasmichot @Kyon147 I have added the support for eventBridgeWebhookSubscriptionCreate, can you please review the PR: https://github.com/osiset/laravel-shopify/pull/1114

Thank you. Vishal Gohil