コンテンツへスキップ
開発者

Webhook

投稿が公開された瞬間にPostNimboがあなたのアドレスに送信するので、Zapier、Make、n8n、または自社サーバーで処理できます。

設定する

  1. 1Settings > Webhooks を開き、名前と公開されたhttpsアドレスを追加します。
  2. 2対象のチャンネルを選びます。何も選ばなければすべてのチャンネルが対象です。
  3. 3イベントを選びます:公開された投稿、フローで集めた見込み客、完了したフロー。
  4. 4Send test event をクリックすると、イベントのサンプルがあなたのアドレスに送信されます。

Zapier、Make、n8nの場合

Zapier、Make、n8n用のPostNimboアプリが登録を代行します。トリガーをオンにするとツールの受信アドレスで POST /public/v1/webhooks が呼び出され、オフにすると DELETE /public/v1/webhooks/:id が呼び出されます。あなたのコードでもAPIキーを使って同じことができます。

Zapier、Make、n8nを設定する

配信方法

  • JSON本文のPOSTで、イベント名はヘッダーに含まれます X-PostNimbo-Event.
  • サーバーは、公開された投稿には10秒以内、フローのイベントには5秒以内に応答する必要があります。フローのイベントは、タイムアウト、429、5xxの応答の後にさらに2回再試行されます。公開された投稿は再試行されません。すぐに応答してから処理を行ってください。
  • 公開されたhttpsアドレスのみ受け付けます。リダイレクト先も公開アドレスである必要があります。
  • すべての配信は、Webhook設定に表示されるシークレットで署名され、次のヘッダーに含まれます X-PostNimbo-Timestamp, X-PostNimbo-Signature.

配信元が当社であることを確認する

タイムスタンプ、ピリオド、生の本文をつなげたものに対し、シークレットでHMAC-SHA256を計算し、署名ヘッダーと定数時間で比較してください。5分以上前のタイムスタンプは拒否してください。

Node.js
const crypto = require('crypto');

// rawBody: the request body exactly as received, before JSON parsing
function fromPostNimbo(rawBody, headers, secret) {
  const timestamp = headers['x-postnimbo-timestamp'];
  const signature = headers['x-postnimbo-signature'] || '';
  if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false;
  const expected =
    'sha256=' +
    crypto
      .createHmac('sha256', secret)
      .update(timestamp + '.' + rawBody)
      .digest('hex');
  return (
    signature.length === expected.length &&
    crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected))
  );
}

イベント

同じ一覧が GET /public/v1/webhooks/events でも提供されるので、ツール側でトリガーとサンプルデータを表示できます。

post.published

A post went live on a channel. Sent once per channel, after the network accepted it, with the post in the array.

Webhooks with no channels get it for every channel; the others only for the channels they list.

ペイロード
[
  {
    "id": "5b9c3f0e-6d0a-4a59-9b8e-2f1c7a4d2e11",
    "content": "<p>Our autumn menu is here.</p>",
    "publishDate": "2026-10-26T09:30:00.000Z",
    "releaseURL": "https://www.linkedin.com/feed/update/urn:li:share:7000000000000000000",
    "state": "PUBLISHED",
    "integration": {
      "id": "c1d2e3f4-0000-4a00-8000-000000000001",
      "name": "Example Bakery",
      "providerIdentifier": "linkedin-page",
      "picture": "https://example.com/avatar.png",
      "type": "social"
    }
  }
]
post.scheduled

A post was queued to publish: scheduled (or published now), rescheduled, approved, or edited while scheduled. Sent once per channel, with the same fields as post.published. The next posts of a repeating post do not send it.

Webhooks with no channels get it for every channel; the others only for the channels they list.

ペイロード
[
  {
    "id": "5b9c3f0e-6d0a-4a59-9b8e-2f1c7a4d2e11",
    "content": "<p>Our autumn menu is here.</p>",
    "publishDate": "2026-10-26T09:30:00.000Z",
    "releaseURL": null,
    "state": "QUEUE",
    "integration": {
      "id": "c1d2e3f4-0000-4a00-8000-000000000001",
      "name": "Example Bakery",
      "providerIdentifier": "linkedin-page",
      "picture": "https://example.com/avatar.png",
      "type": "social"
    }
  }
]
post.failed

A post could not be published, or its publishing could not be confirmed, and is marked as failed. Sent once per channel, with the same fields as post.published (the reason is shown in PostNimbo).

Webhooks with no channels get it for every channel; the others only for the channels they list.

ペイロード
[
  {
    "id": "5b9c3f0e-6d0a-4a59-9b8e-2f1c7a4d2e11",
    "content": "<p>Our autumn menu is here.</p>",
    "publishDate": "2026-10-26T09:30:00.000Z",
    "releaseURL": null,
    "state": "ERROR",
    "integration": {
      "id": "c1d2e3f4-0000-4a00-8000-000000000001",
      "name": "Example Bakery",
      "providerIdentifier": "linkedin-page",
      "picture": "https://example.com/avatar.png",
      "type": "social"
    }
  }
]
lead.captured

An automation flow saved an email or phone number someone typed in answer to a question. Sent once per answer.

Webhooks with no channels get it for every channel's flows; the others only for the flows on the channels they list.

ペイロード
{
  "event": "lead.captured",
  "timestamp": "2026-10-26T09:30:00.000Z",
  "runId": "7d3f2a10-5c4e-4f8a-9a61-0e2b3c4d5e6f",
  "flow": {
    "id": "2a9e7c1b-3d4f-4e5a-8b6c-7d8e9f0a1b2c",
    "name": "Autumn menu giveaway"
  },
  "channel": {
    "id": "c1d2e3f4-0000-4a00-8000-000000000001",
    "network": "instagram",
    "name": "Example Bakery"
  },
  "contact": {
    "id": "4f5e6d7c-8b9a-4c0d-9e1f-2a3b4c5d6e7f",
    "name": "Sam Taylor",
    "username": "samtaylor",
    "email": "sam@example.com",
    "phone": "+447700900123",
    "tags": [
      "giveaway"
    ],
    "fields": {
      "postcode": "SW1A 1AA"
    }
  }
}
flow.completed

Someone reached the end of an automation flow. Sent once per run, with the same fields as lead.captured (email and phone are null when not collected).

Webhooks with no channels get it for every channel's flows; the others only for the flows on the channels they list.

ペイロード
{
  "event": "flow.completed",
  "timestamp": "2026-10-26T09:31:00.000Z",
  "runId": "7d3f2a10-5c4e-4f8a-9a61-0e2b3c4d5e6f",
  "flow": {
    "id": "2a9e7c1b-3d4f-4e5a-8b6c-7d8e9f0a1b2c",
    "name": "Autumn menu giveaway"
  },
  "channel": {
    "id": "c1d2e3f4-0000-4a00-8000-000000000001",
    "network": "instagram",
    "name": "Example Bakery"
  },
  "contact": {
    "id": "4f5e6d7c-8b9a-4c0d-9e1f-2a3b4c5d6e7f",
    "name": "Sam Taylor",
    "username": "samtaylor",
    "email": "sam@example.com",
    "phone": null,
    "tags": [
      "giveaway"
    ],
    "fields": {}
  }
}

PostNimboを使って何か開発していますか?

作っているものを教えてください。APIについてのサポート、ディレクトリ掲載アプリの審査、連携に必要なエンドポイントの追加を行います。