Integrating third party APIs is much harder than it should be. Developers can spend weeks or months authenticating against third party endpoints, setting up webhooks and building out nightly reconciliation jobs.
That’s why we’re excited to announce the launch of Connections, an instant, production ready integration to third party ecommerce platforms, starting with Shopify. The Shopify Connection allows you to quickly connect any Shopify store via OAuth, and access data from any of Shopify's Admin API endpoints. Instead of wiring up webhooks, managing shop installs, and setting up nightly reconciliation processes manually, Gadget developers are now able to setup up a two-way data sync between their app and a Shopify store, with just a couple of clicks.
Here’s how it works:
Note: For now, Gadget only connects to Custom Shopify apps, which are installed on individual Shopify stores. We’ll support public apps (that can be listed on the Shopify App Store) in Q1 2022.
Unlike event-driven integration platforms, Gadget Connections offer a lot more than just a simple way to react to a webhook. Connected models are a two-way data sync between your Gadget app and the store. And because a copy of the data is stored in your Gadget database, you can extend, query or change the behavior of the data to fit your needs. Every time you connect to a Shopify store, Gadget gives you:
Let’s look at an example. If I set up a Gadget application that requests the Shopify Product model, I’ll see new models created in Gadget representing Shopify Product and its associations:
Gadget also generates a CRUD API for my Shopify Product model, represented in a state machine. The CRUD actions in this state machine are automatically wired up to the appropriate webhooks on Shopify’s end.
So, if the Shopify store fires a <inline-code>product/create<inline-code> webhook, we’ll run your Create action which uses the incoming params from the webhook to create a record in your database. If Shopify fires the <inline-code>product/update<inline-code> webhook, Gadget will run your Update action which updates the record with the incoming params.
What’s special about these actions is that they are yours. You can add Preconditions which will determine when the API action is allowed to run, or Effects which will extend what the Action does when an API call is made.
For example, I can quickly teach Gadget to run a tagging script that reads the incoming webhook, and cross-references the content against a set of keywords stored in a separate Gadget model. When there’s a match, I mark the word as a tag and send it back to Shopify.
We’re really excited about the Shopify Connection and how it rids you of the busywork of integrations. It lets you focus on the business logic of your application, while we get to obsess over keeping the data pipelines running smoothly.
For more examples on what you can build using the Shopify Connection, check out these additional blog posts: