Webhooks

サインアップWebhook

外部サインアップからコンテストエントリーを自動作成

サインアップWebhook

POST/api/webhooks/signup/:contestId
Webhook Secret

アプリケーションやサードパーティサービスからのサインアップイベントを受け取り、コンテストエントリーを自動的に作成します。

エンドポイント

text
POST https://blitzrocket.com/api/webhooks/signup/:contestId

パスパラメータ

contestIdstring required

一意のコンテスト識別子

リクエストボディ

emailstring required

新規サインアップのメールアドレス

namestring

新規サインアップの名前(任意)

phonestring

電話番号(任意)

referralCodestring

紹介によるサインアップの場合の紹介コード(任意)

リクエスト

bash
curl -X POST https://blitzrocket.com/api/webhooks/signup/clx1abc123 \
  -H "Content-Type: application/json" \
  -d '{
    "email": "newuser@example.com",
    "name": "New User"
  }'

レスポンス

json
{
  "success": true,
  "data": {
    "entryId": "entry_new789",
    "email": "newuser@example.com",
    "alreadyExists": false,
    "isReferred": false,
    "pointsAwarded": {
      "advocate": 0,
      "friend": 0
    }
  }
}

セットアップガイド

  1. Blitz Rocketダッシュボードのコンテストのデザインページに移動します
  2. コンテスト設定で外部トラッキングを有効にします
  3. あなたのWebhook URLをコピーします: https://blitzrocket.com/api/webhooks/signup/{your-contest-id}
  4. 外部プラットフォームでサインアップイベント時にこのURLへPOSTリクエストを送信するよう設定します

連携例

Shopifyの顧客作成

ShopifyのWebhookをcustomers/createで発火するよう設定します:

javascript
// Shopifyはこのペイロードを自動的に送信します:
{
  "email": "customer@example.com",
  "first_name": "Jane",
  "last_name": "Doe"
}

カスタムサインアップフォーム

javascript
document.querySelector("#signup-form").addEventListener("submit", async (e) => {
  e.preventDefault();

  const form = new FormData(e.target);
  const email = form.get("email");
  const name = form.get("name");

  // まず、自分のシステムに登録
  await registerUser({ email, name });

  // 次に、Webhook経由でコンテストエントリーを作成
  await fetch(
    `https://blitzrocket.com/api/webhooks/signup/${CONTEST_ID}`,
    {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({ email, name }),
    }
  );
});