Notion sync
Apps/Recipes/Notion sync

Sync Shopify products to a Notion database

Every product gets a page in the merchant's Notion database, updated as it changes and archived when it's deleted.

Shopify, customScopes read_productsRecipe id notion-sync

What you'll build

Shopify productcreated · updated · deletedshopifyProduct actiononSuccesssyncProductone at a time per storeNotiona page per product

What it shows: A synced model's own actions driving an outside API, jobs that run one at a time per store, and retrying only what the outside API says to retry.

Before you start

  • The CLI: npm i -g @inferencebureau/apps, then ib-apps login once.
  • A Shopify Partner organization, and a development store to install on.
  • A Notion integration token and a database with the properties the README lists.

Create the app from the recipe

One command creates the app on Inference Bureau and downloads its files into ./my-notion-sync. Shopify recipes need --platform shopify.

ib-apps create my-notion-sync --platform shopify --recipe notion-sync

Tour what the recipe loaded

The recipe lies over the Shopify starter: files of the same path are replaced, and the starter's storefront block is dropped. Here's where each piece lives.

WhereWhat's there
api/models/shopifyProduct/actions/shopifyProduct's create, update and delete queue syncProduct in onSuccess, with concurrencyKey: notion:<shop>.
api/actions/syncProduct.ts, api/lib/notion.tsThe product's page is found by its Shopify ID property each time, so a repeated job updates the page it made. Rate limits and Notion's errors throw and retry; a refused token is kept as lastError for the admin page instead.
api/models/notionConnection/Keeps the integration token as an encryptedString, never sent back to the page.
api/actions/syncAll.ts, checkNotion.tssyncAll queues a sync for every synced product (backfill doesn't run actions), and checkNotion checks the token, the database and its properties.
tests/notion-sync.test.tsSyncs, retries and a refused token, with Notion stubbed.
// api/models/shopifyProduct/actions/update.ts
export const onSuccess: ActionOnSuccess = async ({ record, api }) => {
  // One sync per store at a time: under Notion's rate limit, and two quick edits can't both make the page.
  await api.enqueue("syncProduct", { productGid: record.shopifyId }, { shop: record.shop, concurrencyKey: `notion:${record.shop}`, retries: 8 });
};

Check what it set on the app

Nothing to do here: this is what the recipe configured, so you know where to look in Settings later.

PlatformShopify, custom
Scopesread_products
Admin pagesInference Bureau
Synced modelsshopifyProduct

Connect Shopify and install

  1. Create the Shopify app in your Partner organization
  2. Install on a development store
  3. Paste a Notion integration token and database in the admin, then Sync all

On the Notion side: at notion.so/profile/integrations, make an internal integration and copy its token. Make a database with Name (title), Shopify ID (text), Status (select), Vendor (text), Type (text), Tags (multi-select) and Updated (date), then add the integration under the database's … → Connections.

Run it

ib-apps dev syncs both ways while you work and runs the development server. Saving anything under extensions/ releases it to the development Shopify app by itself.

cd my-notion-sync
ib-apps dev

Logs show a succeeded config release once the extension is live.

Try it end to end

0 of 4 checked

Make it yours

Sync more fields

The page's properties are written in api/lib/notion.ts.

Sync another model

Tick it under Edit scopes and data models, then queue syncProduct's twin from its actions.

Ship it

ib-apps test runs its tests, then ib-apps deploy sends development to production. See Deploys.