メインコンテンツにスキップ

Notion連携ガイド

結論:Surmado(スルマド)とNotion(ノーション)の直接連携はありません。Zapier、Make、n8n、または小さな独自スクリプトでつなぎます。Surmadoの report.completed webhookを受け取り、report.summary のフィールドを使ってNotionの「Create database item」アクションを呼び出します。

読了時間:10分


基本パターン

  1. トリガー:Surmadoが report.completed のペイロードを、webhookのエンドポイント(ZapierのCatch Hook、MakeのCustom Webhook、n8nのWebhook、または自社のサーバー)にPOSTします。
  2. report.summary を読み取る:整理済みの指標が入っています。AI Visibilityでは presence_score、authority_score、competitive_rank などです。Site Auditでは seo_score、performance_score、accessibility_score、critical_issues_count と quick_wins オブジェクトです。Strategyのレポートにはサマリーがないため、report.pdf_url と report.token だけを使います。
  3. Notionのデータベース項目を作成する:ペイロードから対応づけたプロパティの値を入れます。
  4. (任意)情報を追加する:public_intelligence.data.platform_variance や public_intelligence.data.audit_data.enrichment のような、さらに詳しいデータが必要な場合は、GET /v1/reports/{report_id} でREST APIを呼び出します。

Surmadoのレポートを作成するときに webhook_url を渡して、webhookの経路を設定します。

curl -X POST https://api.surmado.com/v1/reports/signal \
  -H "Authorization: Bearer sur_live_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "brand_slug": "acme_corp",
    "url": "https://acme.com",
    "email": "founder@acme.com",
    "industry": "B2B SaaS",
    "location": "United States",
    "persona": "Small business owners",
    "pain_points": "Losing track of customer conversations",
    "brand_details": "Simple CRM with email integration",
    "direct_competitors": "HubSpot, Pipedrive",
    "webhook_url": "https://your-webhook-endpoint.example.com/surmado"
  }'

おすすめのデータベース構成

AI Visibilityレポート

プロパティ 種類 ペイロードのフィールド
Title Title report.summary.business_name
Token Text report.token
Report ID Text report.id
Presence Score Number report.summary.presence_score
Authority Score Number report.summary.authority_score
Competitive Rank Number report.summary.competitive_rank
Top Competitor Text report.summary.top_competitor
Report Date Date timestamp
PDF URL report.pdf_url
Status Select 下記のとおり presence_score から算出

Status のSelectは、ルックアップテーブルで算出できます。

  • presence_score < 30 → At Risk
  • 30 <= presence_score < 60 → Needs Work
  • presence_score >= 60 → Leading

Site Auditレポート

プロパティ 種類 ペイロードのフィールド
Title Title report.summary.business_name またはURL
Token Text report.token
Report ID Text report.id
SEO Score Number report.summary.seo_score
Performance Score Number report.summary.performance_score
Accessibility Score Number report.summary.accessibility_score
Total Pages Number report.summary.total_pages
Critical Issues Number report.summary.critical_issues_count
Report Date Date timestamp
PDF URL report.pdf_url

Strategyレポート

Strategyのレポートでは、webhookで受け取れるのはトークンとPDFのURLだけです。シンプルな構成は次のとおりです。

プロパティ 種類 ペイロードのフィールド
Title Title 算出(ブランド + 日付)
Token Text report.token
Report ID Text report.id
Report Date Date timestamp
PDF URL report.pdf_url

Zapierでの設定(おすすめ)

ZapierのNotion連携には「Create Database Item」アクションがあり、webhookのペイロードにきれいに対応します。

  1. Zapを作成します:Webhooks by Zapier → Catch Hook(発行されたURLをコピーします)。
  2. Surmadoのレポートを、webhook_url にそのURLを設定して作成します。
  3. Filter:event = report.completed AND report__product = signal(または scan)。
  4. アクション:Notion → Create Database Item。webhookの出力を使ってフィールドをマッピングします(Zapierはネストされたキーをアンダースコア2つで平らにします。report__summary__presence_score のようになります)。

サンプルのZapを使った全体の手順:Zapier連携ガイド。


独自スクリプト(Zapierを使わない場合)

コードで構築したい場合は、Surmadoのwebhookを受け取ってNotionのAPIを直接呼び出す、小さなサーバーを動かします。

Node.jsの例

const express = require('express');
const { Client } = require('@notionhq/client');

const notion = new Client({ auth: process.env.NOTION_API_KEY });
const DATABASE_ID = process.env.NOTION_DATABASE_ID;

const app = express();
app.use(express.json());

app.post('/surmado-webhook', async (req, res) => {
  const { event, report, timestamp } = req.body;
  if (event !== 'report.completed' || report.product !== 'signal') {
    return res.status(200).end();
  }

  await notion.pages.create({
    parent: { database_id: DATABASE_ID },
    properties: {
      'Name': { title: [{ text: { content: report.summary.business_name || report.token } }] },
      'Token': { rich_text: [{ text: { content: report.token } }] },
      'Report ID': { rich_text: [{ text: { content: report.id } }] },
      'Presence Score': { number: report.summary.presence_score ?? null },
      'Authority Score': { number: report.summary.authority_score ?? null },
      'Competitive Rank': { number: report.summary.competitive_rank ?? null },
      'Top Competitor': { rich_text: [{ text: { content: report.summary.top_competitor || '' } }] },
      'Report Date': { date: { start: timestamp } },
      'PDF': { url: report.pdf_url || null }
    }
  });

  res.status(200).end();
});

app.listen(process.env.PORT || 3000);

ペイロードを信頼する前に、webhookの署名を検証してください。HMAC-SHA256のアルゴリズムは API連携ガイド をご覧ください。


より詳しいデータでNotionのページを充実させる

webhookのサマリーでほとんどの用途はまかなえます。プラットフォーム別の内訳(たとえばChatGPTとClaude)が必要な場合は、Notionのページを作成したあとにREST APIを呼び出します。

curl -s https://api.surmado.com/v1/reports/{report_id} \
  -H "Authorization: Bearer sur_live_YOUR_API_KEY" \
  | jq '.public_intelligence.data.platform_variance'

そのあと、プラットフォーム別のスコアを入れたリッチテキストのブロックで、Notionのページを更新します。


トラブルシューティング

Notionにページは作成されるが、プロパティが空になる:Notionのフィールドの種類が、ペイロードと合っている必要があります。presence_score のような数値には、Rich Text ではなく Number のプロパティが必要です。各プロパティの種類が、上の表と合っているか確認してください。

webhookは届くが、Notionの呼び出しが失敗する:Surmadoは5xxの応答に対して3回再試行し、そのあとあきらめます。サーバーのログを確認してバグを直し、取りこぼしたレポートについては、REST APIで手動で再取得してください。

Strategyのレポートにスコアが表示されない:想定どおりの動作です。Strategyは public_intelligence を公開しておらず、使えるのは report.token と report.pdf_url だけです。


関連:API連携ガイド | 構造化データとIntelligence Token | Zapier連携 | Make連携 | n8n連携