Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Shopify Application Development

You're reading from   Shopify Application Development Build highly effective Shopify apps using the powerful Ruby on Rails framework

Arrow left icon
Product type Paperback
Published in May 2014
Publisher
ISBN-13 9781783281053
Length 106 pages
Edition Edition
Concepts
Arrow right icon
Author (1):
Arrow left icon
Michael Larkin Michael Larkin
Author Profile Icon Michael Larkin
Michael Larkin
Arrow right icon
View More author details
Toc

Exploring webhooks


Shopify allows applications to subscribe to a series of notifications called webhooks (http://docs.shopify.com/api/webhook) around common events such as order placement, product updates, and customer signup. Real-world events are mapped to topics that can be subscribed to via the API or by manual setup in the Shopify admin panel. The webhook notification mirrors the format of the API, which makes the implementation code reusable. When an event occurs, Shopify automatically sends the notification to all subscribers.

Orders

Order webhooks allow apps to respond in a near real-time fashion when an order is placed or updated in the Shopify store. The following two events are the most commonly subscribed topics that deal with the creation and payment of an Order:

  • orders/create

  • orders/paid

Products

Product webhooks can be handy for apps that handle inventory, product feeds, or back office integrations. The following three events are of interest when dealing with Products:

  • products/create

  • products/update

  • products/delete

Shop/Application

It will be helpful to automatically reflect any updates to a shop's name, URL, and so on in your app. Likewise, it's polite to suspend/cancel a user's account if they uninstall the app from their store. The following two events allow us to do that:

  • shop/update

  • app/uninstall

Webhooks are sent asynchronously after the event occurs. This makes them suitable for near real-time actions and allows an application to process information in smaller chunks, which can reduce the load and improve performance.

Tip

I also recommend using the API to retrieve information as a backup in case the webhook system gets bogged down or a notification is missed.

For public applications, the webhook for uninstalling the application should be subscribed to so that you can automatically suspend the client's account when they remove your app from their Shopify store.

You have been reading a chapter from
Shopify Application Development
Published in: May 2014
Publisher:
ISBN-13: 9781783281053
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image