jpskill.com
🛠️ 開発・MCP コミュニティ

whatsapp-bot-builder

WhatsApp Business APIを活用し、顧客とのコミュニケーションを自動化するチャットボットや、テンプレートメッセージの送信、インタラクティブなリストやボタンの作成などを可能にするSkill。

📜 元の英語説明(参考)

Builds WhatsApp bots and integrations using the WhatsApp Business API (Cloud API). Use when the user wants to create a WhatsApp bot, send template messages, handle incoming messages, build interactive lists and buttons, process media, or automate customer communication via WhatsApp. Trigger words: whatsapp bot, whatsapp business api, whatsapp integration, whatsapp cloud api, whatsapp template, whatsapp webhook, whatsapp automation, whatsapp chatbot, meta business, whatsapp flows.

🇯🇵 日本人クリエイター向け解説

一言でいうと

WhatsApp Business APIを活用し、顧客とのコミュニケーションを自動化するチャットボットや、テンプレートメッセージの送信、インタラクティブなリストやボタンの作成などを可能にするSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o whatsapp-bot-builder.zip https://jpskill.com/download/15563.zip && unzip -o whatsapp-bot-builder.zip && rm whatsapp-bot-builder.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/15563.zip -OutFile "$d\whatsapp-bot-builder.zip"; Expand-Archive "$d\whatsapp-bot-builder.zip" -DestinationPath $d -Force; ri "$d\whatsapp-bot-builder.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して whatsapp-bot-builder.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → whatsapp-bot-builder フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

WhatsApp Bot Builder

概要

公式の Cloud API (Meta がホスト) を使用して WhatsApp ボットを構築します。アカウント設定、Webhook 構成、メッセージの送受信、アウトバウンドキャンペーン用のテンプレートメッセージ、インタラクティブコンポーネント (ボタン、リスト、フロー)、メディア処理、および本番環境へのデプロイを網羅します。非公式ライブラリは使用せず、公式の WhatsApp Business Platform のみを使用します。

手順

1. アカウント設定

  1. https://business.facebook.com で Meta Business アカウントを作成します。
  2. https://developers.facebook.com にアクセス → アプリを作成 → ビジネスタイプ
  3. アプリに "WhatsApp" 製品を追加します。
  4. WhatsApp > スタートガイド:
    • Phone Number IDWhatsApp Business Account ID をメモします。
    • 一時的なアクセストークン (24 時間有効) を生成するか、システムユーザートークン (永続的) を作成します。
  5. テスト電話番号を追加するか、ビジネス番号を認証します。

必要な認証情報:

WHATSAPP_TOKEN=EAAxxxxxxx          # 永続的なシステムユーザートークン
WHATSAPP_PHONE_ID=123456789        # Phone Number ID
WHATSAPP_BUSINESS_ID=987654321     # Business Account ID
WHATSAPP_VERIFY_TOKEN=my_secret    # Webhook 検証トークン (自分で選択)

2. Webhook の設定

WhatsApp は、Webhook 経由で受信メッセージを送信します。

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

// Webhook 検証 (GET)
app.get('/webhook', (req, res) => {
  const mode = req.query['hub.mode'];
  const token = req.query['hub.verify_token'];
  const challenge = req.query['hub.challenge'];

  if (mode === 'subscribe' && token === process.env.WHATSAPP_VERIFY_TOKEN) {
    res.status(200).send(challenge);
  } else {
    res.sendStatus(403);
  }
});

// 受信メッセージ (POST)
app.post('/webhook', (req, res) => {
  const entry = req.body.entry?.[0];
  const change = entry?.changes?.[0];
  const message = change?.value?.messages?.[0];

  if (message) {
    handleMessage(message, change.value.metadata.phone_number_id);
  }

  res.sendStatus(200); // 常に 200 を迅速に応答
});

Meta Developer Console → WhatsApp → 構成 で Webhook URL を登録します。 messagesmessage_statusmessage_template_status_update をサブスクライブします。

3. メッセージの送信

テキストメッセージ:

async function sendText(to, text) {
  await fetch(`https://graph.facebook.com/v21.0/${PHONE_ID}/messages`, {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${TOKEN}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      messaging_product: 'whatsapp',
      to: to,           // 国番号付きの電話番号: '14155552671'
      type: 'text',
      text: { body: text }
    })
  });
}

インタラクティブボタン (最大 3 つ):

{
  messaging_product: 'whatsapp',
  to: to,
  type: 'interactive',
  interactive: {
    type: 'button',
    body: { text: 'How can I help you?' },
    action: {
      buttons: [
        { type: 'reply', reply: { id: 'support', title: '🛠 Support' } },
        { type: 'reply', reply: { id: 'sales', title: '💰 Sales' } },
        { type: 'reply', reply: { id: 'info', title: 'ℹ️ Info' } }
      ]
    }
  }
}

インタラクティブリスト (セクションごとに最大 10 個のアイテム、10 個のセクション):

{
  type: 'interactive',
  interactive: {
    type: 'list',
    body: { text: 'Choose a product category:' },
    action: {
      button: 'View Categories',
      sections: [{
        title: 'Electronics',
        rows: [
          { id: 'phones', title: 'Phones', description: 'Latest smartphones' },
          { id: 'laptops', title: 'Laptops', description: 'Work and gaming' }
        ]
      }]
    }
  }
}

4. テンプレートメッセージ

テンプレートメッセージは、会話を開始するために必要です (アウトバウンド)。Meta によって事前に承認されている必要があります。

テンプレートの作成:

  • WhatsApp Manager → メッセージテンプレート に移動します。
  • カテゴリ: Marketing, Utility, Authentication
  • テンプレートは変数をサポートします: {{1}}, {{2}} など。
  • 承認には数分から数時間かかります。

テンプレートの送信:

{
  messaging_product: 'whatsapp',
  to: to,
  type: 'template',
  template: {
    name: 'order_confirmation',
    language: { code: 'en_US' },
    components: [{
      type: 'body',
      parameters: [
        { type: 'text', text: 'ORD-12345' },
        { type: 'text', text: '$49.99' }
      ]
    }]
  }
}

5. メディアの処理

画像の送信:

{
  messaging_product: 'whatsapp',
  to: to,
  type: 'image',
  image: {
    link: 'https://example.com/photo.jpg',  // パブリック URL
    caption: 'Your order receipt'
  }
}

メディアの受信: messages[0].image.id を抽出し、次に:

// メディア URL を取得
const media = await fetch(`https://graph.facebook.com/v21.0/${mediaId}`, {
  headers: { 'Authorization': `Bearer ${TOKEN}` }
}).then(r => r.json());

// ファイルをダウンロード
const file = await fetch(media.url, {
  headers: { 'Authorization': `Bearer ${TOKEN}` }
});

サポートされているもの: 画像 (5MB)、動画 (16MB)、音声 (16MB)、ドキュメント (100MB)、ステッカー。

6. 会話の料金

WhatsApp は、24 時間の会話ウィンドウごとに課金します。

  • サービス会話 (ユーザー開始): 最初の 1,000 件/月は無料、その後は国によって約 $0.005-0.08
  • マーケティング/ユーティリティ会話 (ビジネス開始): 1 会話あたり約 $0.01-0.15
  • 認証: 約 $0.005-0.09

24 時間のウィンドウは、最初に返信するか、テンプレートを送信したときに開きます。そのウィンドウ内のすべてのメッセージは 1 つの会話です。

7. レート制限

  • 新しいビジネスアカウント: 250 件のビジネス開始会話/24 時間
  • 認証済みアカウント: 1,000 件/24 時間、品質に基づいて 10K、100K、無制限にスケーリング
  • API 呼び出し: Cloud API の場合 80 メッセージ/秒
  • テンプレートの送信: 作成の場合 100 件/時間

8. デプロイ

  • HTTPS が必要 — WhatsApp は Webhook に TLS を要求します。
  • ローカル開発には ngrok を使用します。
  • 本番環境: SSL を使用した任意の Node.js ホスト (Railway、Render、Caddy/nginx を使用した VPS)
  • メッセージの重複排除を実装します (WhatsApp は Webhook の配信を再試行する場合があります)。

例 1

(原文はここで切り詰められています)

📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

WhatsApp Bot Builder

Overview

Builds WhatsApp bots using the official Cloud API (hosted by Meta). Covers account setup, webhook configuration, sending and receiving messages, template messages for outbound campaigns, interactive components (buttons, lists, flows), media handling, and production deployment. Does NOT use unofficial libraries — only the official WhatsApp Business Platform.

Instructions

1. Account Setup

  1. Create a Meta Business account at https://business.facebook.com
  2. Go to https://developers.facebook.com → Create App → Business type
  3. Add "WhatsApp" product to the app
  4. In WhatsApp > Getting Started:
    • Note the Phone Number ID and WhatsApp Business Account ID
    • Generate a temporary access token (valid 24h) or create a System User token (permanent)
  5. Add a test phone number or verify your business number

Required credentials:

WHATSAPP_TOKEN=EAAxxxxxxx          # Permanent System User token
WHATSAPP_PHONE_ID=123456789        # Phone Number ID
WHATSAPP_BUSINESS_ID=987654321     # Business Account ID  
WHATSAPP_VERIFY_TOKEN=my_secret    # Webhook verification token (you choose this)

2. Webhook Setup

WhatsApp sends incoming messages via webhooks:

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

// Webhook verification (GET)
app.get('/webhook', (req, res) => {
  const mode = req.query['hub.mode'];
  const token = req.query['hub.verify_token'];
  const challenge = req.query['hub.challenge'];

  if (mode === 'subscribe' && token === process.env.WHATSAPP_VERIFY_TOKEN) {
    res.status(200).send(challenge);
  } else {
    res.sendStatus(403);
  }
});

// Incoming messages (POST)
app.post('/webhook', (req, res) => {
  const entry = req.body.entry?.[0];
  const change = entry?.changes?.[0];
  const message = change?.value?.messages?.[0];

  if (message) {
    handleMessage(message, change.value.metadata.phone_number_id);
  }

  res.sendStatus(200); // Always respond 200 quickly
});

Register webhook URL in Meta Developer Console → WhatsApp → Configuration. Subscribe to: messages, message_status, message_template_status_update.

3. Sending Messages

Text message:

async function sendText(to, text) {
  await fetch(`https://graph.facebook.com/v21.0/${PHONE_ID}/messages`, {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${TOKEN}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      messaging_product: 'whatsapp',
      to: to,           // Phone number with country code: '14155552671'
      type: 'text',
      text: { body: text }
    })
  });
}

Interactive buttons (max 3):

{
  messaging_product: 'whatsapp',
  to: to,
  type: 'interactive',
  interactive: {
    type: 'button',
    body: { text: 'How can I help you?' },
    action: {
      buttons: [
        { type: 'reply', reply: { id: 'support', title: '🛠 Support' } },
        { type: 'reply', reply: { id: 'sales', title: '💰 Sales' } },
        { type: 'reply', reply: { id: 'info', title: 'ℹ️ Info' } }
      ]
    }
  }
}

Interactive list (up to 10 items per section, 10 sections):

{
  type: 'interactive',
  interactive: {
    type: 'list',
    body: { text: 'Choose a product category:' },
    action: {
      button: 'View Categories',
      sections: [{
        title: 'Electronics',
        rows: [
          { id: 'phones', title: 'Phones', description: 'Latest smartphones' },
          { id: 'laptops', title: 'Laptops', description: 'Work and gaming' }
        ]
      }]
    }
  }
}

4. Template Messages

Template messages are required for initiating conversations (outbound). They must be pre-approved by Meta.

Creating templates:

  • Go to WhatsApp Manager → Message Templates
  • Categories: Marketing, Utility, Authentication
  • Templates support variables: {{1}}, {{2}}, etc.
  • Approval takes minutes to hours

Sending a template:

{
  messaging_product: 'whatsapp',
  to: to,
  type: 'template',
  template: {
    name: 'order_confirmation',
    language: { code: 'en_US' },
    components: [{
      type: 'body',
      parameters: [
        { type: 'text', text: 'ORD-12345' },
        { type: 'text', text: '$49.99' }
      ]
    }]
  }
}

5. Media Handling

Send image:

{
  messaging_product: 'whatsapp',
  to: to,
  type: 'image',
  image: {
    link: 'https://example.com/photo.jpg',  // Public URL
    caption: 'Your order receipt'
  }
}

Receive media: Extract messages[0].image.id, then:

// Get media URL
const media = await fetch(`https://graph.facebook.com/v21.0/${mediaId}`, {
  headers: { 'Authorization': `Bearer ${TOKEN}` }
}).then(r => r.json());

// Download the file
const file = await fetch(media.url, {
  headers: { 'Authorization': `Bearer ${TOKEN}` }
});

Supported: images (5MB), video (16MB), audio (16MB), documents (100MB), stickers.

6. Conversation Pricing

WhatsApp charges per 24-hour conversation window:

  • Service conversations (user-initiated): Free first 1,000/month, then ~$0.005-0.08 depending on country
  • Marketing/Utility conversations (business-initiated): ~$0.01-0.15 per conversation
  • Authentication: ~$0.005-0.09

The 24h window opens when you first reply or send a template. All messages within that window are one conversation.

7. Rate Limits

  • New business accounts: 250 business-initiated conversations/24h
  • Verified accounts: 1,000/24h, scaling to 10K, 100K, unlimited based on quality
  • API calls: 80 messages/sec for Cloud API
  • Template submissions: 100/hour for creation

8. Deployment

  • Must have HTTPS — WhatsApp requires TLS for webhooks
  • Use ngrok for local development
  • Production: any Node.js host with SSL (Railway, Render, VPS with Caddy/nginx)
  • Implement message deduplication (WhatsApp may retry webhook deliveries)

Examples

Example 1: Customer Support Bot

Input: "Build a WhatsApp bot for our e-commerce store. Customers can check order status, request returns, and talk to a human agent."

Output: A Node.js webhook server with:

  • Welcome message with 3 reply buttons (Order Status / Return / Talk to Agent)
  • Order status flow: asks for order number, queries database, returns status with tracking link
  • Return flow: multi-step conversation collecting order number, reason, photo of item
  • Agent handoff: notifies support team in a shared WhatsApp group, bridges messages
  • Auto-reply outside business hours with template message

Example 2: Appointment Booking Bot

Input: "Create a WhatsApp bot for a dental clinic. Patients book appointments, get reminders, and can reschedule."

Output: A Node.js app with:

  • Interactive list showing available time slots by date
  • Booking confirmation with template message (approved by Meta)
  • 24h reminder template sent via cron job
  • Reschedule flow with new slot selection
  • Integration with Google Calendar API for availability

Guidelines

  • Always respond HTTP 200 to webhooks within 5 seconds (process async)
  • Use template messages for initiating conversations — free-form messages only work in the 24h reply window
  • Implement idempotency — WhatsApp retries webhook deliveries on timeout
  • Store wa_id (WhatsApp ID) not phone number for user identification
  • Handle message status updates (sent, delivered, read, failed) for tracking
  • Keep button titles under 20 characters, list row titles under 24 characters
  • Test thoroughly with the test phone number before going to production
  • Meta can reject template messages — keep them professional and compliant
  • Implement conversation state with Redis or database (not in-memory)
  • For high volume: use a message queue between webhook receiver and processor
  • Never expose your permanent token — use environment variables
  • WhatsApp Flows (form-based UI) is available for more complex interactions