Notion 與 Firecrawl / Apify 網頁自動化採集、競品價格監控與結構化情報庫閉環實戰

2026 年 11 月 21 日

一、為什麼商業戰略與運營團隊需要將 Firecrawl / Apify 情報流沉澱至 Notion?

對於 B2B SaaS 市場部、跨境獨立站運營與產品戰略團隊而言,競品的定價頁調整、新品 SKU 上架、Changelog 版本釋出與海外渠道評論波動,是決定投放與研發優先順序的核心外部訊號。如果僅依賴人工每週手動開啟瀏覽器巡檢,或者用一次性本機指令碼把結果匯出成 CSV,很快會陷入三大運營盲區:

  1. 動態渲染網頁難以提取,人工核對耗時且易遺漏:現代 SaaS 定價頁與電商獨立站普遍採用 React / Next.js 使用者端渲染或價格懶載入,傳統靜態爬蟲抓取到的往往是空白骨架 HTML,員工只能每週手工截圖貼上到共享文件,無法做結構化比對;
  2. 缺少內容指紋去重,重複報警淹沒真正有效的價格異動:競品官網可能因為頁尾版權年份或廣告 Banner 輪播發生微小 DOM 變動,如果每次巡檢都向團隊推送一條全量記錄,Notion 資料庫很快會被“無實質變更”的噪音快照塞滿;
  3. 情報停留在唯讀表格中,無法驅動研發與銷售協同處置:看到競品降價 20% 或上線新功能後,如果沒有自動關聯至銷售話術庫或產品需求工單,情報採集就無法轉化為實際的商業動作。

將 Firecrawl(專精高保真網頁轉 Markdown 與 JSON Schema 結構化抽取) 及 Apify(擅長大規模分散式瀏覽器 Actor 自動化與電商/社媒採集) 接入 Notion 結構化情報庫,能夠以極低的維護成本構建全天候競品雷達:

方案維度 人工每週巡檢截圖 傳統 RSS / 網頁變化外掛 自建 Playwright + 本機 CSV Notion + Firecrawl / Apify 閉環(推薦)
SPA 動態頁面解析 人工肉眼可見,但無法自動化 僅支援靜態 HTML,極易失效 需自行維護無頭瀏覽器叢集與代理池 Firecrawl / Apify 原生託管渲染與反爬排程
結構化欄位抽取 需人工抄錄價格與方案規格 僅返回整頁 HTML Diff,可讀性差 需為每個網站硬編碼 CSS 選擇器 Schema 結構化欄位直接對映 Notion 屬性
變更去重與歷史對比 覆蓋舊記錄,無法追溯歷史走勢 僅發郵件通知,缺少時序臺賬 分散在本機檔案,非技術人員無法檢視 SHA-256 指紋去重 + 時序快照關聯歷史比價
團隊協同與預警閉環 微信群截圖口頭討論,容易遺忘 無任務指派與 SLA 追蹤機制 無法直接關聯產品需求與銷售話術 異動自動置頂紅框預警 + 派發應對工單

Notion 與 Firecrawl / Apify 網頁自動化採集、競品價格監控與示意圖

二、四步搭建“監控靶標 × 變更快照 × 應對工單”三表競品情報架構

參照 Notion 企業級資料庫架構設計規範 與 關係和彙總官方指南,建議構建 監控靶標主檔(DB_Monitor_Targets)、結構化變更快照庫(DB_Intel_Snapshots) 與 情報應對工單庫(DB_Action_Tickets) 的三表聯動架構。

步驟 1:設計三表核心欄位與 URL 歸一化冪等鍵

為了防止同一網址因為附帶 ?utm_source=xxx 追蹤引數而被重複建卡,必須先對 URL 執行歸一化清洗(規則詳見 URL、Email 與 Phone 屬性清洗規範),並以“靶標標識 + 內容 SHA-256 雜湊”作為快照表的冪等主鍵:

所屬資料庫 屬性名稱 屬性型別 工程規範與業務用途
DB_Monitor_Targets Target_Name Title 監控物件名稱(如 Competitor A - 定价页)
DB_Monitor_Targets Canonical_URL URL 清洗掉追蹤引數後的規範監控 URL
DB_Monitor_Targets Collector_Engine Select Firecrawl_Extract / Apify_Actor(路由不同採集引擎)
DB_Monitor_Targets Check_Cycle_Hours Number 允許的最大采集間隔小時數(如 24 小時)
DB_Intel_Snapshots Snapshot_Title Title 快照摘要(如 [2026-11-21] Competitor A 价格变更)
DB_Intel_Snapshots Snapshot_Key Rich Text 冪等主鍵:{target_id}:{sha256_prefix_16}
DB_Intel_Snapshots Target_Relation Relation 雙向關聯至 DB_Monitor_Targets,支援縱向趨勢追蹤
DB_Intel_Snapshots Unit_Price_USD Number 抽取出的核心方案單價或 SKU 售價(USD)
DB_Intel_Snapshots Stock_Available Checkbox 競品 SKU 當前是否處於有貨可售狀態
DB_Intel_Snapshots Captured_At Date 實際完成網頁渲染採集的 UTC 時間戳
DB_Action_Tickets Ticket_Title Title 策略應對動作(如 跟进调整黑五促销优惠券)
DB_Action_Tickets Source_Snapshot Relation 關聯觸發本次決策的具體快照記錄

步驟 2:配置 Firecrawl Schema 抽取與 Apify Actor Webhook

  1. Firecrawl 結構化提取:針對定價頁、版本更新日誌(Changelog)等圖文頁面,呼叫 Firecrawl /v1/scrape 介面時傳入 formats: ["markdown", "json"] 與標準 JSON Schema(宣告 plan_name、monthly_price_usd、stock_available、key_highlights 等嚴格欄位型別),並設定 waitFor: 2500 等待前端非同步價格介面渲染完畢;
  2. Apify 定時 Actor 排程:針對電商平臺搜尋排名或需要翻頁載入的清單,在 Apify Console 配置每日定時 Schedule,並在 Integrations -> Webhooks 中勾選 ACTOR.RUN.SUCCEEDED 事件,將 defaultDatasetId 即時推送至企業同步閘道器。

步驟 3:在閘道器層執行“內容指紋去重”與“正文分段寫入”

閘道器收到採集結果後,切勿無腦往 DB_Intel_Snapshots 新增頁面:

  • 僅對業務關心的結構化欄位(價格、庫存狀態、核心特性清單)序列化計算 SHA-256 雜湊,剔除頁面頁尾時間戳、隨機廣告 ID 等干擾項;
  • 先按 Snapshot_Key 在 DB_Intel_Snapshots 查重:若雜湊與上一次最新快照完全一致,僅需更新 DB_Monitor_Targets 的“最近巡檢時間”,避免生成海量冗餘空轉記錄;
  • 若提取的 Markdown 摘要超過 Notion 單塊 2,000 字元上限,閘道器自動按 1,800 字元切分為多個 paragraph 塊寫入快照詳情頁正文。

步驟 4:基於 Notion-Version: 2026-03-11 自動置頂異動警告塊

所有 API 呼叫統一宣告請求頭 Notion-Version: 2026-03-11(升級規範詳見 Notion Views API 與 2026-03-11 介面升級工程實戰)。當檢測到競品單價下跌幅度 ≥ 10% 或熱門競品突然缺貨(Stock_Available == false)時,閘道器不僅寫入新快照,還會呼叫 Blocks API 的 position: { type: "start" } 在對應靶標頁面頂部置頂插入紅色高亮 callout 告警塊,確保市場與銷售負責人開啟頁面第一眼即看到關鍵異動。


三、Node.js 生產級採集與入庫實戰:Webhook 驗籤、雜湊去重與 429 退避

以下 Node.js(Express)生產級閘道器程式碼演示如何接收 Firecrawl / Apify 的採集完成 Webhook 通知、驗證共享簽名頭、基於結構化載荷計算去重指紋,並使用 Notion-Version: 2026-03-11 Data Sources 介面完成增量寫庫與頂部置頂預警(限流架構詳見 Notion API 速率限制與容錯架構):

// intel_collector_gateway.js — Node.js 18+ 竞品情报同步网关
const crypto = require('node:crypto');
const express = require('express');

const app = express();
const NOTION_TOKEN = process.env.NOTION_TOKEN;
const TARGETS_DS_ID = process.env.NOTION_TARGETS_DS_ID;
const SNAPSHOTS_DS_ID = process.env.NOTION_SNAPSHOTS_DS_ID;
const WEBHOOK_SECRET = process.env.COLLECTOR_WEBHOOK_SECRET;

app.use('/webhook/intel', express.raw({ type: 'application/json' }));

function verifyHmacSignature(rawBody, signatureHeader) {
  if (!signatureHeader || !WEBHOOK_SECRET) return false;
  const expected = crypto
    .createHmac('sha256', WEBHOOK_SECRET)
    .update(rawBody)
    .digest('hex');
  const provided = signatureHeader.replace(/^sha256=/, '').trim();
  if (expected.length !== provided.length) return false;
  return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(provided));
}

async function notionRequest(path, method = 'GET', body = null, attempt = 0) {
  const res = await fetch(`https://api.notion.com/v1${path}`, {
    method,
    headers: {
      'Authorization': `Bearer ${NOTION_TOKEN}`,
      'Notion-Version': '2026-03-11',
      'Content-Type': 'application/json',
    },
    body: body ? JSON.stringify(body) : undefined,
  });

  if (res.status === 429 && attempt < 4) {
    const retryAfter = Number(res.headers.get('retry-after') || '1') * 1000;
    const jitter = Math.floor(Math.random() * 250);
    await new Promise((r) => setTimeout(r, retryAfter + 350 * (2 ** attempt) + jitter));
    return notionRequest(path, method, body, attempt + 1);
  }
  if (!res.ok) {
    throw new Error(`Notion API ${res.status}: ${await res.text()}`);
  }
  return res.json();
}

function canonicalizeUrl(rawUrl) {
  const parsed = new URL(rawUrl);
  for (const key of Array.from(parsed.searchParams.keys())) {
    if (key.startsWith('utm_') || key === 'ref' || key === 'fbclid') {
      parsed.searchParams.delete(key);
    }
  }
  return parsed.toString().replace(/\/$/, '');
}

function splitMarkdownChunks(text, limit = 1800) {
  const chunks = [];
  for (let i = 0; i < text.length; i += limit) {
    chunks.push(text.slice(i, i + limit));
  }
  return chunks.slice(0, 20);
}

async function ingestIntelSnapshot(payload) {
  const { targetUrl, unitPriceUsd, prevPriceUsd, stockAvailable, summaryMarkdown } = payload;
  const cleanUrl = canonicalizeUrl(targetUrl);

  // 1. 查找所属监控靶标记录
  const targetRes = await notionRequest(`/data_sources/${TARGETS_DS_ID}/query`, 'POST', {
    filter: { property: 'Canonical_URL', url: { equals: cleanUrl } },
    page_size: 1,
  });
  const targetPage = targetRes.results?.[0];
  if (!targetPage) return { skipped: true, reason: 'unregistered_target' };

  // 2. 仅对核心结构化业务字段计算 SHA-256 幂等指纹
  const stableFingerprint = crypto
    .createHash('sha256')
    .update(JSON.stringify({ cleanUrl, unitPriceUsd, stockAvailable, summaryMarkdown: (summaryMarkdown || '').slice(0, 500) }))
    .digest('hex')
    .slice(0, 16);
  const snapshotKey = `${targetPage.id.replace(/-/g, '')}:${stableFingerprint}`;

  const dupCheck = await notionRequest(`/data_sources/${SNAPSHOTS_DS_ID}/query`, 'POST', {
    filter: { property: 'Snapshot_Key', rich_text: { equals: snapshotKey } },
    page_size: 1,
  });
  if (dupCheck.results?.length) {
    return { skipped: true, reason: 'unchanged_content', snapshotKey };
  }

  // 3. 写入新变更快照并安全分段填充正文块
  const nowIso = new Date().toISOString();
  const blocks = splitMarkdownChunks(summaryMarkdown || '无额外摘要文本').map((chunk) => ({
    object: 'block',
    type: 'paragraph',
    paragraph: { rich_text: [{ type: 'text', text: { content: chunk } }] },
  }));

  const created = await notionRequest('/pages', 'POST', {
    parent: { type: 'data_source_id', data_source_id: SNAPSHOTS_DS_ID },
    properties: {
      Snapshot_Title: { title: [{ text: { content: `[${nowIso.slice(0, 10)}] $${unitPriceUsd} 采集快照` } }] },
      Snapshot_Key: { rich_text: [{ text: { content: snapshotKey } }] },
      Target_Relation: { relation: [{ id: targetPage.id }] },
      Unit_Price_USD: { number: typeof unitPriceUsd === 'number' ? unitPriceUsd : null },
      Stock_Available: { checkbox: Boolean(stockAvailable) },
      Captured_At: { date: { start: nowIso } },
    },
    children: blocks,
  });

  // 4. 若出现 ≥10% 降价或断货,通过 2026-03-11 position 置顶红框告警
  const priceDropRatio = prevPriceUsd > 0 ? (prevPriceUsd - unitPriceUsd) / prevPriceUsd : 0;
  if (priceDropRatio >= 0.1 || stockAvailable === false) {
    const alertMsg = priceDropRatio >= 0.1
      ? `竞品价格下调 ${(priceDropRatio * 100).toFixed(1)}%(现价 $${unitPriceUsd}),请评估促销跟进方案。`
      : '检测到竞品主推规格处于缺货状态,可适时加大关联广告预算抢占流量。';
    await notionRequest(`/blocks/${targetPage.id}/children`, 'PATCH', {
      position: { type: 'start' },
      children: [
        {
          object: 'block',
          type: 'callout',
          callout: {
            icon: { type: 'emoji', emoji: '🚨' },
            color: 'red_background',
            rich_text: [{ type: 'text', text: { content: alertMsg } }],
          },
        },
      ],
    });
  }

  return { createdId: created.id, snapshotKey };
}

app.post('/webhook/intel', async (req, res) => {
  const sig = req.header('x-collector-signature');
  if (!verifyHmacSignature(req.body, sig)) {
    return res.status(401).json({ error: 'Invalid webhook signature' });
  }
  const payload = JSON.parse(req.body.toString('utf8'));
  res.status(200).json({ accepted: true });
  ingestIntelSnapshot(payload).catch((err) => console.error('Intel ingest failed:', err));
});

四、Formula 2.0 實戰:競品價格波動率測算、異動熔斷與採集新鮮度 SLA 門禁

在 DB_Monitor_Targets(監控靶標主檔)中新增 Formula 2.0 屬性 价格异动与采集 SLA 门禁(更多語法見 Notion Formula 2.0 速查手冊 與 官方公式教程)。該公式自動對所關聯的 Intel_Snapshots 按採集時間排序,提取最新價格與前次價格計算漲跌幅,同時校驗最近一次抓取是否超出 SLA 週期:

lets(
  snaps, prop("Intel_Snapshots").sort(current.prop("Captured_At")),
  totalCount, snaps.length(),
  latestSnap, snaps.last(),
  prevSnap, if(totalCount >= 2, snaps.at(totalCount - 2), latestSnap),

  latestPrice, if(empty(latestSnap), 0, latestSnap.prop("Unit_Price_USD")),
  prevPrice, if(empty(prevSnap), 0, prevSnap.prop("Unit_Price_USD")),
  inStock, if(empty(latestSnap), true, latestSnap.prop("Stock_Available")),

  deltaPct, if(prevPrice > 0 && latestPrice > 0, round(((latestPrice - prevPrice) / prevPrice) * 1000) / 10, 0),
  lastCaptured, if(empty(latestSnap), prop("Created time"), latestSnap.prop("Captured_At")),
  hoursStale, dateBetween(now(), lastCaptured, "hours"),
  maxHours, if(empty(prop("Check_Cycle_Hours")), 24, prop("Check_Cycle_Hours")),

  ifs(
    totalCount == 0,
      style("⚪ 待首次采集:尚未生成结构化快照", "gray"),
    hoursStale > maxHours,
      style("⏰ 采集超时断流(已超 " + format(hoursStale) + " 小时):请检查目标网站反爬拦截或 Actor 配额", "red", "bold", "red_background"),
    not(inStock),
      style("📦 竞品断货机会窗 · 最新报价 $" + format(latestPrice) + "(建议放大竞价投放)", "orange", "bold"),
    deltaPct <= -10,
      style("🚨 竞品大幅降价 " + format(deltaPct) + "%($" + format(prevPrice) + " → $" + format(latestPrice) + "):需派单应对", "red", "bold", "red_background"),
    deltaPct >= 10,
      style("📈 竞品涨价 +" + format(deltaPct) + "%(现价 $" + format(latestPrice) + "):利好我方定价优势", "green", "bold"),
    style("🟢 价格平稳($" + format(latestPrice) + ")· 采集于 " + format(hoursStale) + " 小时前", "green")
  )
)

五、Firecrawl / Apify 整合 Notion 常見故障排查

在長期執行競品自動採集管道時,最容易出現的四類工程問題與排查手段如下(更多排查方法參閱 Notion 常見報錯與故障診斷手冊):

  1. 抓取 React / Shopify 動態定價頁返回 Unit_Price_USD 為空:預設快速抓取可能在 JS 價格元件渲染前就提取了 DOM。解法:在 Firecrawl 請求中顯式開啟 waitFor: 2500 或指定 actions 等待價格選擇器出現;若目標站存在地理 IP 貨幣切換,必須在 Apify / Firecrawl 代理配置中固定 country: "US",防止美元與歐元混入同一指標列。
  2. 同一產品頁面因營銷引數不同被反覆建為多個靶標:團隊成員在錄入競品 URL 時直接複製了帶 ?utm_source=google 或 ?variant=123 的推廣連結。解法:除在閘道器側執行 canonicalizeUrl() 清洗追蹤引數外,建議在 Notion 靶標庫配合公式校驗 Canonical_URL 是否包含 utm_,並建立規範的錄入檢查檢視。
  3. 長篇競品 Changelog 寫入 Notion 報 400 validation_error:Notion Blocks API 規定單個 rich_text 物件的 text.content 長度不得超過 2000 字元。解法:閘道器必須對抓取到的 Markdown 摘要進行安全切片(如按 1800 字元拆分為多個 paragraph 塊),不可整段直接寫入單個屬性或塊中。
  4. Apify 批次採集完成後瞬間推來上千條記錄導致 429 漏單:全量電商清單單次執行可能產出數百個 SKU 變動,直接併發寫庫會穿透 Notion API 每秒約 3 次的平均限流閾值。解法:收到 Webhook 通知後立即返回 200 OK,通過記憶體任務佇列或持久化訊息佇列控制併發度在 2 ~ 2.5 RPS 以內,嚴格遵循響應頭 Retry-After 執行指數退避重試。

❓ 常見問題與答疑 (FAQ)

高頻疑難解析與避坑指南
A

完全不需要。绝大多数核心功能在免费 Starter 计划中均可完整体验与实操练习,无需额外付费购买付费团队版。