Overview

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.

Installing the Shopify packages

To get started with our Shopify integration, you need to install the @trigger.dev/shopify packages. You can do this using npm, pnpm, or yarn:

npm install @trigger.dev/shopify@latest

Runtime Adapter

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!
// Import the Node.js adapter
import "@shopify/shopify-api/adapters/node";

// Import the CloudFlare Worker adapter
import "@shopify/shopify-api/adapters/cf-worker";

// Import the generic Web API adapter
import "@shopify/shopify-api/adapters/web-api";

You can then import and use @trigger.dev/shopify like any other integration:

import "@shopify/shopify-api/adapters/node";
import { Shopify } from "@trigger.dev/shopify";

const shopify = new Shopify({
  ...
});

Authentication

You can use Personal Access Tokens to authenticate with Shopify and get started with building custom apps.

Personal Access Tokens

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 at the very least. If the topic you subscribe to is triggered by an action that requires write access, e.g. orders/create, then write access is also required, e.g. write_orders.

Additionally, you will also have to provide your shop domain.

my-job.ts
import "@shopify/shopify-api/adapters/node";
import { Shopify } from "@trigger.dev/shopify";

//create Shopify client using a token
const 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!,
});
...

Triggers and Tasks

Once you have set up a Shopify client, you can use it to create triggers and tasks.

Example jobs

Code examples

Check out pre-built jobs using Shopify in our API section.