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

agent-whatsappbot

Cloud APIの認証情報を使ってWhatsAppと連携し、メッセージ送信やテンプレート管理など、WhatsAppの機能をビジネスで活用するための自動化を支援するSkill。

📜 元の英語説明(参考)

Interact with WhatsApp using Cloud API credentials - send messages, manage templates

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

一言でいうと

Cloud APIの認証情報を使ってWhatsAppと連携し、メッセージ送信やテンプレート管理など、WhatsAppの機能をビジネスで活用するための自動化を支援するSkill。

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

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

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

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

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

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して agent-whatsappbot.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → agent-whatsappbot フォルダができる
  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 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Agent WhatsAppBot

WhatsApp Business Cloud API を通じて AI エージェントや人間がメッセージを送信できるようにする TypeScript CLI ツールです。電話番号 ID + アクセストークン認証を使用した、顧客への通知、トランザクションメッセージング、CI/CD 統合向けに設計されています。

主要な概念

始める前に、WhatsApp Business Cloud API についていくつか知っておくべきことがあります。

  • 送信専用 — Cloud API はインバウンドメッセージに対しては webhook 専用です。この CLI で受信メッセージを一覧表示したり、読み取ったりすることはできません。
  • テンプレートメッセージ — 24 時間のカスタマーサービス時間外では、事前承認されたメッセージテンプレートを使用する必要があります。自由形式のテキストは、顧客の最後のメッセージから 24 時間以内にのみ機能します。
  • 電話番号 ID — WhatsApp Business 電話番号の一意の識別子(電話番号自体ではありません)。Meta Business Manager にあります。
  • アクセストークンwhatsapp_business_messaging 権限を持つ Meta Business Manager からの永続的または一時的なトークン。
  • Meta Business Manager — すべての設定(電話番号、テンプレート、検証)は business.facebook.com で行われます。
  • レート制限 — ティア 0-3: 1 秒あたり 80 メッセージ。ティア 4: 1 秒あたり 1,000 メッセージ。ティアは、ビジネスの検証とメッセージングの量に基づいています。

クイックスタート

# API 認証情報を設定します
agent-whatsappbot auth set your-phone-number-id your-access-token

# 認証を確認します
agent-whatsappbot auth status

# テキストメッセージを送信します(受信者は 24 時間以内にメッセージを送信している必要があります)
agent-whatsappbot message send 15551234567 "Hello from the CLI!"

# 利用可能なメッセージテンプレートを一覧表示します
agent-whatsappbot template list --pretty

認証

API 認証情報の設定

agent-whatsappbot は、Meta Business Manager からの電話番号 ID + アクセストークンのペアを使用します。

# 認証情報を設定します(保存する前に WhatsApp Cloud API に対して検証します)
agent-whatsappbot auth set your-phone-number-id your-access-token

# 認証ステータスを確認します
agent-whatsappbot auth status

# 保存された認証情報をクリアします
agent-whatsappbot auth clear

複数アカウントの管理

# 保存されたアカウントを一覧表示します
agent-whatsappbot auth list

# アクティブなアカウントを切り替えます
agent-whatsappbot auth use <account-id>

# 保存されたアカウントを削除します
agent-whatsappbot auth remove <account-id>

メモリ

エージェントは、セッション間で永続的なメモリとして ~/.config/agent-messenger/MEMORY.md ファイルを保持します。これはエージェントによって管理され、CLI はこのファイルを読み書きしません。メモリファイルを管理するには、Read ツールと Write ツールを使用します。

メモリの読み取り

すべてのタスクの開始時に、~/.config/agent-messenger/MEMORY.mdRead ツールを使用して読み取り、以前に検出されたアカウント ID、テンプレート名、受信者番号、および設定をロードします。

  • ファイルがまだ存在しない場合は、問題ありません。それなしで続行し、最初に役立つ情報を保存するときに作成します。
  • ファイルを読み取れない場合(権限、ディレクトリの欠落)、メモリなしで続行します。エラーを出さないでください。

メモリの書き込み

役立つ情報を発見した後、Write ツールを使用して ~/.config/agent-messenger/MEMORY.md を更新します。書き込みトリガーには以下が含まれます。

  • アカウント ID と電話番号の発見後(auth listauth status などから)
  • テンプレート名とそのパラメータの発見後(template listtemplate get などから)
  • ユーザーがエイリアスまたは設定を与えた後(「これを通知アカウントと呼ぶ」、「私のメインテンプレートは X」)

書き込むときは、完全なファイルの内容を含めます。Write ツールはファイル全体を上書きします。

保存するもの

  • 電話番号付きのアカウント ID
  • 必要なパラメータ付きのテンプレート名
  • コンテキスト付きの頻繁に使用される受信者番号
  • ユーザーが指定したエイリアス(「通知アカウント」、「マーケティング番号」)
  • インタラクション中に表明されたユーザー設定

保存しないもの

アクセストークンや認証情報を保存しないでください。メッセージの完全な内容(コンテキストのみ)を保存しないでください。個人ユーザーデータを保存しないでください。

古いデータの処理

記憶されたテンプレートがエラーを返す場合(テンプレートが見つからない、アカウントが無効)、MEMORY.md から削除します。記憶されたデータを盲目的に信頼しないでください。何かおかしい場合は確認してください。古くなっている可能性のある記憶された値を使用するよりも、再リストすることを優先してください。

形式/例

# Agent Messenger Memory

## WhatsApp Accounts

- `112233445566` - Acme Notifications (Phone: +1 555 012 3456)

## Templates (Acme Notifications)

- `order_confirmation` - language: en_US, params: [customer_name, order_id]
- `shipping_update` - language: en_US, params: [customer_name, tracking_number]
- `appointment_reminder` - language: en_US, params: [customer_name, date, time]

## Frequent Recipients

- `15559876543` - Support escalation line
- `15551112222` - QA test number

## Aliases

- "notifications" -> `112233445566` (Acme Notifications)

## Notes

- order_confirmation template requires customer_name and order_id as components
- Business verified at Tier 2 (80 MPS limit)

メモリを使用すると、繰り返しの template list 呼び出しをスキップできます。以前のセッションからテンプレート名がすでにわかっている場合は、直接使用してください。

コマンド

Auth コマンド

# アカウント認証情報を設定します(API に対して検証します)
agent-whatsappbot auth set <phone-number-id> <access-token>

# 認証ステータスを確認します
agent-whatsappbot auth status
agent-whatsappbot auth status --account <account-id>

# 保存されたアカウントを一覧表示します
agent-whatsappbot auth list

# アクティブなアカウントを切り替えます
agent-whatsappbot auth use <account-id>

# 保存されたアカウントを削除します
agent-whatsappbot auth remove <account-id>

# すべての認証情報をクリアします
agent-whatsappbot auth clear

Whoami コマンド

# 現在認証されているボットを表示します
agent-whatsappbot whoami
agent-whatsappbot whoami --pretty
agent-whatsappbot whoami --account <account-id>

Message コマンド

# テキストメッセージを送信します
agent-whatsappbot message send <to> <text>
agent-whatsappbot message send 15551234567 "Your order has shipped!"

# テンプレートメッセージを送信します
agent-whatsappbot message send-template <to> <template-name>
agent-whatsappbot message send-t
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Agent WhatsAppBot

A TypeScript CLI tool that enables AI agents and humans to send messages through WhatsApp Business Cloud API. Designed for customer notifications, transactional messaging, and CI/CD integrations using Phone Number ID + Access Token authentication.

Key Concepts

Before diving in, a few things about WhatsApp Business Cloud API:

  • Send-only — The Cloud API is webhook-only for inbound messages. This CLI cannot list or read received messages.
  • Template messages — Outside the 24-hour customer service window, you must use pre-approved message templates. Free-form text only works within 24 hours of the customer's last message.
  • Phone Number ID — Your WhatsApp Business phone number's unique identifier (not the phone number itself). Found in Meta Business Manager.
  • Access Token — A permanent or temporary token from Meta Business Manager with whatsapp_business_messaging permission.
  • Meta Business Manager — All setup (phone numbers, templates, verification) happens at business.facebook.com.
  • Rate limits — Tier 0-3: 80 messages per second. Tier 4: 1,000 messages per second. Tiers are based on business verification and messaging volume.

Quick Start

# Set your API credentials
agent-whatsappbot auth set your-phone-number-id your-access-token

# Verify authentication
agent-whatsappbot auth status

# Send a text message (recipient must have messaged you within 24h)
agent-whatsappbot message send 15551234567 "Hello from the CLI!"

# List available message templates
agent-whatsappbot template list --pretty

Authentication

API Credential Setup

agent-whatsappbot uses Phone Number ID + Access Token pairs from Meta Business Manager:

# Set credentials (validates against WhatsApp Cloud API before saving)
agent-whatsappbot auth set your-phone-number-id your-access-token

# Check auth status
agent-whatsappbot auth status

# Clear stored credentials
agent-whatsappbot auth clear

Multi-Account Management

# List stored accounts
agent-whatsappbot auth list

# Switch active account
agent-whatsappbot auth use <account-id>

# Remove a stored account
agent-whatsappbot auth remove <account-id>

Memory

The agent maintains a ~/.config/agent-messenger/MEMORY.md file as persistent memory across sessions. This is agent-managed, the CLI does not read or write this file. Use the Read and Write tools to manage your memory file.

Reading Memory

At the start of every task, read ~/.config/agent-messenger/MEMORY.md using the Read tool to load any previously discovered account IDs, template names, recipient numbers, and preferences.

  • If the file doesn't exist yet, that's fine. Proceed without it and create it when you first have useful information to store.
  • If the file can't be read (permissions, missing directory), proceed without memory. Don't error out.

Writing Memory

After discovering useful information, update ~/.config/agent-messenger/MEMORY.md using the Write tool. Write triggers include:

  • After discovering account IDs and phone numbers (from auth list, auth status, etc.)
  • After discovering template names and their parameters (from template list, template get, etc.)
  • After the user gives you an alias or preference ("call this the notifications account", "my main template is X")

When writing, include the complete file content. The Write tool overwrites the entire file.

What to Store

  • Account IDs with phone numbers
  • Template names with their required parameters
  • Frequently used recipient numbers with context
  • User-given aliases ("notifications account", "marketing number")
  • Any user preference expressed during interaction

What NOT to Store

Never store access tokens or any credentials. Never store full message content (just context). Never store personal user data.

Handling Stale Data

If a memorized template returns an error (template not found, account invalid), remove it from MEMORY.md. Don't blindly trust memorized data. Verify when something seems off. Prefer re-listing over using a memorized value that might be stale.

Format / Example

# Agent Messenger Memory

## WhatsApp Accounts

- `112233445566` - Acme Notifications (Phone: +1 555 012 3456)

## Templates (Acme Notifications)

- `order_confirmation` - language: en_US, params: [customer_name, order_id]
- `shipping_update` - language: en_US, params: [customer_name, tracking_number]
- `appointment_reminder` - language: en_US, params: [customer_name, date, time]

## Frequent Recipients

- `15559876543` - Support escalation line
- `15551112222` - QA test number

## Aliases

- "notifications" -> `112233445566` (Acme Notifications)

## Notes

- order_confirmation template requires customer_name and order_id as components
- Business verified at Tier 2 (80 MPS limit)

Memory lets you skip repeated template list calls. When you already know a template name from a previous session, use it directly.

Commands

Auth Commands

# Set account credentials (validates against API)
agent-whatsappbot auth set <phone-number-id> <access-token>

# Check auth status
agent-whatsappbot auth status
agent-whatsappbot auth status --account <account-id>

# List stored accounts
agent-whatsappbot auth list

# Switch active account
agent-whatsappbot auth use <account-id>

# Remove a stored account
agent-whatsappbot auth remove <account-id>

# Clear all credentials
agent-whatsappbot auth clear

Whoami Command

# Show current authenticated bot
agent-whatsappbot whoami
agent-whatsappbot whoami --pretty
agent-whatsappbot whoami --account <account-id>

Message Commands

# Send a text message
agent-whatsappbot message send <to> <text>
agent-whatsappbot message send 15551234567 "Your order has shipped!"

# Send a template message
agent-whatsappbot message send-template <to> <template-name>
agent-whatsappbot message send-template 15551234567 order_confirmation --language en_US --components '[{"type":"body","parameters":[{"type":"text","text":"Alice"},{"type":"text","text":"ORD-9876"}]}]'

# Send a reaction to a message
agent-whatsappbot message send-reaction <to> <message-id> <emoji>
agent-whatsappbot message send-reaction 15551234567 wamid.abc123 "👍"

# Send an image
agent-whatsappbot message send-image <to> <url>
agent-whatsappbot message send-image 15551234567 "https://example.com/photo.jpg" --caption "Product photo"

# Send a document
agent-whatsappbot message send-document <to> <url>
agent-whatsappbot message send-document 15551234567 "https://example.com/invoice.pdf" --filename "invoice.pdf" --caption "Your invoice"

Template Commands

# List message templates
agent-whatsappbot template list
agent-whatsappbot template list --limit 20

# Get template details
agent-whatsappbot template get <template-name>
agent-whatsappbot template get order_confirmation

Output Format

JSON (Default)

All commands output JSON by default for AI consumption:

{
  "messaging_product": "whatsapp",
  "contacts": [{ "input": "15551234567", "wa_id": "15551234567" }],
  "messages": [{ "id": "wamid.HBgNMTU1NTEyMzQ1NjcVAgA..." }]
}

Pretty (Human-Readable)

Use --pretty flag for formatted output:

agent-whatsappbot template list --pretty

Global Options

Option Description
--pretty Human-readable output instead of JSON
--account <id> Use a specific account for this command

Common Patterns

See references/common-patterns.md for additional workflows.

Send a notification outside the 24h window

Template messages are required when the customer hasn't messaged you in the last 24 hours. Always check your available templates first:

# List templates to find the right one
agent-whatsappbot template list --pretty

# Get template details to see required parameters
agent-whatsappbot template get order_confirmation --pretty

# Send the template message
agent-whatsappbot message send-template 15551234567 order_confirmation \
  --language en_US \
  --components '[{"type":"body","parameters":[{"type":"text","text":"Alice"},{"type":"text","text":"ORD-9876"}]}]'

Send a free-form reply within the 24h window

When a customer has messaged you within the last 24 hours, you can send any text:

agent-whatsappbot message send 15551234567 "Thanks for reaching out! We'll look into this right away."

Send a document with a receipt

agent-whatsappbot message send-document 15551234567 "https://example.com/receipt.pdf" \
  --filename "receipt-2024-01.pdf" \
  --caption "Here's your receipt for January"

CI/CD deployment notification

agent-whatsappbot message send-template 15559876543 deployment_alert \
  --language en_US \
  --components '[{"type":"body","parameters":[{"type":"text","text":"v2.1.0"},{"type":"text","text":"production"},{"type":"text","text":"success"}]}]'

Templates

See templates/ directory for runnable examples:

  • post-message.sh - Send messages with error handling and retries
  • account-summary.sh - Generate account and template summary
  • send-template.sh - Send a template message with parameters

Error Handling

All commands return consistent error format:

{
  "error": "No credentials. Run \"auth set <phone-number-id> <access-token>\" first."
}

Common errors: No credentials, Account not found, Template not found, Invalid phone number format, Message failed to send (outside 24h window, use a template).

Configuration

Credentials stored in ~/.config/agent-messenger/whatsappbot-credentials.json (0600 permissions).

Config format:

{
  "current": { "account_id": "112233445566" },
  "accounts": {
    "112233445566": {
      "account_id": "112233445566",
      "phone_number_id": "112233445566",
      "phone_number": "+1 555 012 3456",
      "access_token": "..."
    }
  }
}

Key Differences from agent-whatsapp

Feature agent-whatsapp agent-whatsappbot
Auth type User account (Baileys, QR/pairing) Cloud API (Phone Number ID + Token)
Token source Pairing flow with phone number Meta Business Manager
Read messages Yes No (webhook-only inbound)
Group chats Yes No
Template messages No Yes (required outside 24h window)
Free-form text Anytime Only within 24h customer window
Media uploads Direct (local files) URL only
Multi-account Multi-phone, single CLI session Multi-account by Phone Number ID
CI/CD friendly Requires phone, pairing flow Yes (just set token)

Limitations

  • Cannot list or read received messages — WhatsApp Cloud API delivers inbound messages via webhooks only. This CLI is send-only.
  • Template messages required outside 24h window — Free-form text only works within 24 hours of the customer's last message to you.
  • Business verification required for higher tiers — Unverified businesses are limited in daily messaging volume.
  • Rate limits — Tier 0-3: 80 messages per second. Tier 4: 1,000 messages per second.
  • No group chat support — WhatsApp Cloud API does not support group messaging.
  • No real-time events / WebSocket connection — Inbound messages require a separate webhook server.
  • No message editing or deletion
  • No file upload from local disk — Images and documents must be provided as URLs.
  • No voice or video calls
  • Phone number must be registered with WhatsApp Business — Personal WhatsApp numbers won't work.

Troubleshooting

agent-whatsappbot: command not found

agent-whatsappbot is NOT the npm package name. The npm package is agent-messenger.

If the package is installed globally, use agent-whatsappbot directly:

agent-whatsappbot message send 15551234567 "Hello"

If the package is NOT installed, run it directly with npx -y:

npx -y agent-messenger whatsappbot message send 15551234567 "Hello"

Note: If the user prefers a different package runner (e.g., bunx, pnpx, pnpm dlx), use that instead.

NEVER run npx agent-whatsappbot, bunx agent-whatsappbot, or pnpm dlx agent-whatsappbot. It will fail or install a wrong package since agent-whatsappbot is not the npm package name.

How to get API credentials

  1. Go to Meta Business Manager
  2. Navigate to your WhatsApp Business Account
  3. Open WhatsApp Manager > Phone Numbers to find your Phone Number ID
  4. Go to Business Settings > System Users to create a system user and generate an Access Token with whatsapp_business_messaging permission
  5. Run agent-whatsappbot auth set <phone-number-id> <access-token>

Template messages not sending

  • Verify the template exists: agent-whatsappbot template get <name>
  • Check the template status is APPROVED (not PENDING or REJECTED)
  • Ensure the --language matches the template's language code exactly
  • Verify --components JSON matches the template's parameter structure

Rate limiting

WhatsApp enforces rate limits based on your business tier. The CLI automatically retries on rate limit (429) responses. For bulk operations, add delays between requests to avoid hitting limits.

Message not delivered

  • Confirm the recipient's phone number is on WhatsApp
  • Use full international format without + prefix (e.g., 15551234567 not +1-555-123-4567)
  • If outside the 24h window, use message send-template instead of message send
  • Check that your WhatsApp Business account is active and not restricted

References