Automation & Integration8 min read

How to Integrate Pipedream with Your Headless CMS

Connect Pipedream to your headless CMS so every publish, update, or delete can trigger the right workflow across Slack, Airtable, HubSpot, GitHub, BigQuery, and your own APIs.

Published April 29, 2026
01Overview

What is Pipedream?

Pipedream is an automation and integration platform built for developers who need workflows that can mix app connectors with custom code. It runs workflows from HTTP requests, schedules, app events, and code steps in Node.js, Python, Go, and Bash. Teams use Pipedream when no-code automation is too limited, but building and hosting a custom integration service would take too much time.


02The case for integration

Why integrate Pipedream with a headless CMS?

Content changes rarely stop at the website. A product launch might need to update a changelog, notify a sales channel, create a support macro, open a QA task, and send structured data to a warehouse. If those steps depend on someone copying fields between tools, you'll get stale data, missed steps, and inconsistent formatting.


03Architecture

Architecture overview

A typical Sanity and Pipedream integration starts with structured content in Sanity's Content Lake. A Sanity webhook uses a GROQ filter, for example _type == "article" && defined(slug.current), so only relevant publish or update events fire. The webhook sends a small payload, usually the document ID and event type, to a Sanity Function or an API route you control. That handler uses @sanity/client and GROQ to fetch exactly the fields Pipedream needs, including referenced data like author names, category titles, or linked product SKUs. The handler then calls Pipedream's HTTP trigger URL with fetch, sending JSON to a workflow. Inside Pipedream, the workflow can branch, run code, call connected apps, and return data to the tools your team uses. The end user sees the result as a Slack message, a CRM update, a search index refresh, a warehouse row, or a customer-facing page that reflects the latest content.


04Use cases

Common use cases

📣

Publish notifications with context

Send Slack or Microsoft Teams alerts from Pipedream when Sanity content is published, including owner, locale, URL, and linked campaign data.

📊

Content events to a warehouse

Push article, product, or documentation updates from Sanity through Pipedream into BigQuery, Snowflake, or Postgres for reporting.

🎫

Editorial handoffs

Create Jira, Linear, or GitHub issues from Sanity workflow states, such as readyForReview or needsLegalApproval.

🔁

Multi-app sync from one event

Use one Sanity publish event to run a Pipedream workflow that updates Airtable, HubSpot, Algolia, and an internal API.


05Implementation

Step-by-step integration

  1. 1

    Set up Pipedream

    Create a Pipedream account, create a new workflow, choose the HTTP / Webhook trigger, and copy the generated endpoint URL. If you're also using Pipedream's REST API or Pipedream Connect, create an API key in Pipedream settings and install the SDK with npm install @pipedream/sdk.

  2. 2

    Model the content in Sanity Studio

    Define the fields your workflow needs, not just what the page renders. For an article workflow, include title, slug, locale, workflowStatus, author reference, category reference, canonicalUrl, and publishDate.

  3. 3

    Create a filtered Sanity webhook

    In Sanity, create a webhook for create, update, and delete events. Use a GROQ filter such as _type == "article" && workflowStatus == "published" and a projection such as {"id": _id, "type": _type, "rev": _rev} so the first payload stays small.

  4. 4

    Fetch the full document with GROQ

    In a Sanity Function, Next.js route, or small middleware service, use @sanity/client to fetch the latest document by ID. Project only the fields Pipedream needs, including joins across references.

  5. 5

    Send the event to Pipedream

    POST the shaped JSON payload to the Pipedream HTTP trigger URL. In Pipedream, add steps for connected apps, code, branching, retries, and error notifications.

  6. 6

    Test the end-to-end flow

    Publish a test document in Sanity Studio, confirm the webhook fired, inspect the Pipedream event payload, and verify the final user-facing result, such as a Slack alert, CRM update, or search index change.


06Code

Code example

typescript
import {createClient} from '@sanity/client'
import type {NextRequest} from 'next/server'

const sanity = createClient({
  projectId: process.env.SANITY_PROJECT_ID!,
  dataset: process.env.SANITY_DATASET!,
  apiVersion: '2025-02-19',
  token: process.env.SANITY_READ_TOKEN,
  useCdn: false,
})

export async function POST(req: NextRequest) {
  const {id, type, rev} = await req.json()

  const doc = await sanity.fetch(
    `*[_id == $id][0]{
      _id,
      _type,
      title,
      "slug": slug.current,
      locale,
      publishDate,
      "author": author->name,
      "category": category->title
    }`,
    {id}
  )

  if (!doc) return Response.json({skipped: true})

  const response = await fetch(process.env.PIPEDREAM_HTTP_TRIGGER_URL!, {
    method: 'POST',
    headers: {'content-type': 'application/json'},
    body: JSON.stringify({
      event: 'sanity.content.published',
      source: 'sanity',
      type,
      rev,
      document: doc,
    }),
  })

  if (!response.ok) {
    throw new Error(`Pipedream failed with ${response.status}`)
  }

  return Response.json({sent: true})
}

07Why Sanity

How Sanity + Pipedream works

Build your Pipedream integration on Sanity

Sanity gives you the structured content foundation, real-time event system, and flexible APIs to connect Pipedream workflows to the tools your teams already use.

Start building free →

08Comparison

CMS approaches to Pipedream

CapabilityTraditional CMSSanity
Workflow trigger qualityGROQ-filtered webhooks and Functions trigger only the events your Pipedream workflow should handle.
Data shape for automationThe Content Lake stores structured JSON, and GROQ can join references before the payload reaches Pipedream.
Server-side sync logicFunctions can run server-side logic on content mutations without a separate integration service.
Field-level controlGROQ projections select exact fields, rename keys, follow references, sort arrays, and keep Pipedream payloads small.
AI agent readinessAgent Context gives production AI agents read-only, scoped access to structured content from the same foundation used by Pipedream.
Setup trade-offSchema-as-code and GROQ take developer setup, but they give you a clear contract for long-running Pipedream workflows.

09Next steps

Keep building

Explore related integrations to complete your content stack.

Ready to try Sanity?

See how Sanity's Content Operating System powers integrations with Pipedream and 200+ other tools.