Shopify / shopify_app

A Rails Engine for building Shopify Apps
MIT License
1.77k stars 692 forks source link

Receive Webhooks with localhost:3000 #336

Closed SylarRuby closed 8 years ago

SylarRuby commented 8 years ago

Can the webhook address be http://localhost:3000/webhooks/products_update? If yes then nothing is working. When I ran the code below, then edited a product in shopify, my console shows nothing after hitting the save button:

rails g shopify_app:add_webhook -t products/update -a http://localhost:3000/webhooks/products_update
kevinhughes27 commented 8 years ago

You cannot receive a webhook to localhost since only your computer knows what the address of your own localhost is. Shopify can't route to your machine unless you tell it how. I recommend using ngrok or forward to test webhooks locally.

On Aug 28, 2016 7:06 AM, "Daveyon Mayne" notifications@github.com wrote:

Can the webhook address be http://localhost:3000/webhooks/products_update? If yes then nothing is working. When I ran the code below, then edited a product in shopify, my console shows nothing after hitting the save button:

rails g shopify_app:add_webhook -t products/update -a http://localhost:3000/webhooks/products_update

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Shopify/shopify_app/issues/336, or mute the thread https://github.com/notifications/unsubscribe-auth/AB39sZmM4KDj6vdu7TqthPV2bk2E4mzrks5qkWvLgaJpZM4Ju5io .

SylarRuby commented 8 years ago

In your youtube video I see you used https://forwardhq.com 😉 Thanks

SylarRuby commented 8 years ago

@kevinhughes27 Ive used the link above to get a forward. Link works but still not triggering a product update. Nothing in console when I change a product price. Do I need to do something in shopify? Im now using Rails 5.

buggy commented 8 years ago

https://ngrok.com/ works well. Make sure you've modified the webhooks configuration in config/initializers/shopify_app.rb to use the URL that ngrok provides and that you've re-install the app so that it adds the webhooks with the correct address. You can monitor webhook callbacks in the terminal window that you launched ngrok in.

Also, if you re-start ngrok remember that you'll get a different URL so your old webhooks will start failing if the app is still installed.

SylarRuby commented 8 years ago

@buggy Ok. One draw back to all this. If I need to add another webhook, the user has to reinstall the app. Tell me there is another way of adding webhooks.

kevinhughes27 commented 8 years ago

If you need at add another webhook later you can do it in a rake task or something.

On Aug 28, 2016 12:12 PM, "Daveyon Mayne" notifications@github.com wrote:

Closed #336 https://github.com/Shopify/shopify_app/issues/336.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Shopify/shopify_app/issues/336#event-770007703, or mute the thread https://github.com/notifications/unsubscribe-auth/AB39sUqkysxeCEUEyEjFhgCXhbvVSiY7ks5qkbNygaJpZM4Ju5io .