Our Shopify integration allows you to create triggers and tasks that interact with Shopify. Trigger jobs when events happen, like when a new product is added to a shop, or when an order is paid for, etc. You can also perform tasks like creating products, editing variants, getting information about an order, and a lot more.
It’s required to import the correct Runtime Adapter for your platform. All examples will use the Node.js adapter, but you can change this to any of the following or even create your own custom adapter.
Only import one adapter!
Copy
Ask AI
// Import the Node.js adapterimport "@shopify/shopify-api/adapters/node";// Import the CloudFlare Worker adapterimport "@shopify/shopify-api/adapters/cf-worker";// Import the generic Web API adapterimport "@shopify/shopify-api/adapters/web-api";
You can then import and use @trigger.dev/shopify like any other integration:
Copy
Ask AI
import "@shopify/shopify-api/adapters/node";import { Shopify } from "@trigger.dev/shopify";const shopify = new Shopify({ ...});
To create the tokens on Shopify, login and follow the instructions.The required scopes depend on the tasks you wish to perform and which webhooks you intend to receive. Webhooks will generally need read access to the respective Shopify resource.Additionally, you will also have to provide your shop domain.
my-job.ts
Copy
Ask AI
import "@shopify/shopify-api/adapters/node";import { Shopify } from "@trigger.dev/shopify";//create Shopify client using a tokenconst shopify = new Shopify({ id: "shopify", adminAccessToken: process.env.SHOPIFY_ADMIN_ACCESS_TOKEN!, apiKey: process.env.SHOPIFY_API_KEY!, apiSecretKey: process.env.SHOPIFY_API_SECRET_KEY!, hostName: process.env.SHOPIFY_SHOP_DOMAIN!,});...