Skip to content

Business operating system for Claude Code — 57 skills, 21 agents, smart daemon. Unified inbox (WhatsApp/Email/Slack/Telegram), autonomous PR merge, full-AWS monitoring, revenue (Stripe+RevenueCat), e-commerce (Shopify), marketing (Klaviyo/Meta/GA4), voice (Bland/ElevenLabs), APM (Datadog/NewRelic/OTEL), YOLO mode.

10.9 KB
Raw Blame

phase: "14-whatsapp-business" plan: "01" subsystem: ops-whatsapp-biz tags: [whatsapp-business, waba, cloud-api, templates, catalog, setup] dependency_graph: requires: [] provides: [whatsapp-biz-template-send, whatsapp-biz-template-management, whatsapp-biz-catalog, whatsapp-biz-setup] affects: [skills/ops-whatsapp-biz/SKILL.md, skills/setup/SKILL.md]

Phase 14 Plan 01: WhatsApp Business API

Goal

Create a new skills/ops-whatsapp-biz/SKILL.md skill for the WhatsApp Business Cloud API (Meta Graph API), distinct from wacli personal WhatsApp. Implement approved template sends (single + bulk), template management (list/create/check status), product catalog viewer, and a guided setup wizard sub-flow integrated into /ops:setup. This is business-to-customer messaging at scale — not personal chat.

Requirements Addressed

  • WhatsApp Business Cloud API integration for outbound marketing and transactional messages
  • Template management lifecycle (create → approval → send)
  • Product catalog integration

Runtime Prerequisites

STOP — the following credentials must be configured before this plan can execute:

Credential Where to get it
WABA_TOKEN Meta Business Manager → WhatsApp → API Setup → Access Token (Permanent System User token recommended; temp tokens expire in 24h)
WABA_PHONE_ID Meta Business Manager → WhatsApp → API Setup → Phone Number ID (numeric)
WABA_ACCOUNT_ID Meta Business Manager → WhatsApp → Overview → WhatsApp Business Account ID

Account requirements:

  • WhatsApp Business Account (WABA) verified with Meta
  • Phone number verified and registered in the WABA
  • For production sends: business verification completed with Meta
  • Templates must be pre-approved by Meta (2-24h review time) before sending

Pricing note: WhatsApp Business API charges per conversation, not per message. Marketing conversations: ~$0.0125/conversation (US). Display pricing note on send operations.

Separate from wacli: This skill uses the WhatsApp Business Cloud API (graph.facebook.com/v19.0/{phone-number-id}/messages). The personal wacli uses whatsmeow bridge. Different credentials, different phone numbers, different use cases. Never conflate the two.

Deliverables

Files to Create

  • claude-ops/skills/ops-whatsapp-biz/SKILL.md — new skill: credential resolution, sub-command routing, send-template, list-templates, create-template, check-template, catalog, setup sub-commands

Files to Modify

  • claude-ops/skills/setup/SKILL.md — add WhatsApp Business API setup sub-flow in Step 3 marketing section

Task Breakdown

Task 1: Create ops-whatsapp-biz/SKILL.md skeleton + credential resolution

File: claude-ops/skills/ops-whatsapp-biz/SKILL.md (new)

YAML frontmatter:

---
name: ops-whatsapp-biz
description: WhatsApp Business Cloud API — send approved template messages at scale, manage templates with approval tracking, and integrate product catalogs. Separate from wacli personal WhatsApp.
argument-hint: '[send-template|list-templates|create-template|check-template|catalog|setup]'
allowed-tools: [Bash, Read, Write, Grep, AskUserQuestion]
effort: medium
maxTurns: 30
---

Key difference section explaining separation from wacli (prominent, at top).

Credential resolution (3-tier: plugin config → env → Doppler):

PREFS_PATH="${CLAUDE_PLUGIN_DATA_DIR:-$HOME/.claude/plugins/data/ops-ops-marketplace}/preferences.json"
WABA_TOKEN="${WHATSAPP_BUSINESS_TOKEN:-$(claude plugin config get whatsapp_business_token 2>/dev/null)}"
WABA_PHONE_ID="${WHATSAPP_PHONE_NUMBER_ID:-$(claude plugin config get whatsapp_phone_number_id 2>/dev/null)}"
WABA_ACCOUNT_ID="${WHATSAPP_BUSINESS_ACCOUNT_ID:-$(claude plugin config get whatsapp_business_account_id 2>/dev/null)}"
# Doppler fallbacks
[ -z "$WABA_TOKEN" ] && WABA_TOKEN="$(doppler secrets get WHATSAPP_BUSINESS_TOKEN --plain 2>/dev/null)"
[ -z "$WABA_PHONE_ID" ] && WABA_PHONE_ID="$(doppler secrets get WHATSAPP_PHONE_NUMBER_ID --plain 2>/dev/null)"
[ -z "$WABA_ACCOUNT_ID" ] && WABA_ACCOUNT_ID="$(doppler secrets get WHATSAPP_BUSINESS_ACCOUNT_ID --plain 2>/dev/null)"
# preferences.json fallbacks (written by setup wizard Task 5)
if [ -f "$PREFS_PATH" ]; then
  [ -z "$WABA_TOKEN" ] && WABA_TOKEN="$(jq -r '.marketing.whatsapp_business.token // empty' "$PREFS_PATH" 2>/dev/null)"
  [ -z "$WABA_PHONE_ID" ] && WABA_PHONE_ID="$(jq -r '.marketing.whatsapp_business.phone_number_id // empty' "$PREFS_PATH" 2>/dev/null)"
  [ -z "$WABA_ACCOUNT_ID" ] && WABA_ACCOUNT_ID="$(jq -r '.marketing.whatsapp_business.business_account_id // empty' "$PREFS_PATH" 2>/dev/null)"
fi

Credential guard: if WABA_TOKEN or WABA_PHONE_ID empty, print setup hint and stop.

Sub-command routing table:

Input Action
(empty), list-templates List all templates with approval status
send-template Send an approved template message
create-template Guided template creation wizard
check-template <NAME> Poll approval status for a template
catalog View linked product catalog
setup Configure WhatsApp Business credentials

Task 2: Template Listing and Sending

File: claude-ops/skills/ops-whatsapp-biz/SKILL.md

List Templates (list-templates / empty):

GET https://graph.facebook.com/v19.0/{WABA_ACCOUNT_ID}/message_templates?fields=name,status,category,language,components&access_token={WABA_TOKEN}

Output table:

══ WHATSAPP TEMPLATES ══
Name                  Category    Language  Status
order_confirmation    UTILITY     en        ✓ APPROVED
promo_offer           MARKETING   en        ✗ REJECTED
shipping_update       UTILITY     nl        … PENDING

Status mapping: APPROVED → ✓ APPROVED, REJECTED → ✗ REJECTED, PENDING → … PENDING, DELETED → — DELETED

Pricing note printed after table: Note: WA Business API charges per conversation (~$0.0125 marketing, ~$0.005 utility, US).

Send Template (send-template):

AskUserQuestion (multi-step):

  • Step 1: template name (must be in APPROVED state)
  • Step 2: recipient phone number(s) — single number or comma-separated list for bulk
  • Step 3: template variable values (if template has {{1}}, {{2}} parameters — parse components from list-templates first)

For single send: POST to /{WABA_PHONE_ID}/messages:

{
  "messaging_product": "whatsapp",
  "to": "<phone_e164>",
  "type": "template",
  "template": {
    "name": "<template_name>",
    "language": {"code": "en"},
    "components": [{"type": "body", "parameters": [{"type": "text", "text": "<value>"}]}]
  }
}

For bulk (comma-separated phones):

  • AskUserQuestion confirmation (Rule 5): show recipient count + cost estimate (count × $0.0125)
  • Loop sends with 100ms delay between each to avoid rate limits

Print message ID for each successful send.

Task 3: Template Creation and Status Checking

File: claude-ops/skills/ops-whatsapp-biz/SKILL.md

Create Template (create-template) — guided wizard:

AskUserQuestion sequence:

  • Template name (lowercase, underscores, max 512 chars)
  • Category: UTILITY / MARKETING / AUTHENTICATION
  • Language code (en / nl / es / de / fr — show common list)
  • Header (optional): TEXT / IMAGE / VIDEO / DOCUMENT
  • Body text (required): enter template text with {{N}} placeholders for variables
  • Footer (optional): short text
  • Buttons (optional): QUICK_REPLY / URL / PHONE_NUMBER

POST to /{WABA_ACCOUNT_ID}/message_templates:

{
  "name": "<name>",
  "category": "<CATEGORY>",
  "language": "<code>",
  "components": [...]
}

Print template ID; note 2-24h review time. Run check-template <name> to monitor.

Check Template Status (check-template <NAME>):

GET /{WABA_ACCOUNT_ID}/message_templates?name=<NAME>&fields=name,status,rejected_reason

Print current status + reason if rejected:

Template: order_confirmation
Status:   ✓ APPROVED
Language: en

If REJECTED: print Rejected reason: <reason> and suggest edits.

Task 4: Product Catalog Sub-command

File: claude-ops/skills/ops-whatsapp-biz/SKILL.md

GET https://graph.facebook.com/v19.0/{WABA_ACCOUNT_ID}?fields=message_template_namespace to confirm linked Business Manager.

GET /{catalog_id}/products?fields=retailer_id,name,price,currency,availability,condition&limit=20

(Catalog ID resolved from Business Manager if not cached.)

Output table: SKU | Name | Price | Currency | Availability | Condition

Note: Catalog must be linked in Meta Commerce Manager. Suggest meta catalog for full catalog management.

Task 5: Add WhatsApp Business setup sub-flow to setup/SKILL.md

File: claude-ops/skills/setup/SKILL.md

Add #### WhatsApp Business API sub-section in Step 3 (distinct from wacli personal WhatsApp):

  • Step A: Explain difference from personal wacli
  • Step B: WABA Token — AskUserQuestion (keep auto-scan result or reconfigure)
  • Step C: Phone Number ID — from API Setup page
  • Step D: WABA Account ID — from Overview page
  • Step E: Smoke test — GET /{WABA_ACCOUNT_ID}/message_templates returns ≥ 0 templates
  • Step F: Save to preferences.json under marketing.whatsapp_business.*

Add whatsapp-biz, waba shortcuts to setup routing table.

Threat Model

ID Threat Mitigation
T-14-01-01 Bulk send to unintended recipient list Mitigated — AskUserQuestion (Rule 5) shows count + cost before bulk; requires explicit confirmation
T-14-01-02 WABA Token in env/preferences has broad account access Mitigated — use Permanent System User token scoped to WABA; store in preferences.json not source
T-14-01-03 Sending unapproved template causes account suspension Mitigated — skill checks template status before send; refuses to send non-APPROVED templates
T-14-01-04 Message costs accumulate without visibility Mitigated — cost estimate displayed before every send; pricing note on template list
T-14-01-05 Conflation with wacli causing wrong account sends Mitigated — prominent "Key difference" section at top of skill; separate credential variables

Dependencies

  • Requires: WhatsApp Business Account (WABA) verified with Meta; at least one approved template to test sends
  • Provides: whatsapp-biz-template-send, whatsapp-biz-template-management, whatsapp-biz-catalog, whatsapp-biz-setup

Success Criteria (Self-Check)

  • claude-ops/skills/ops-whatsapp-biz/SKILL.md exists and passes bash -n (after stripping SKILL frontmatter)
  • grep "WABA_TOKEN" claude-ops/skills/ops-whatsapp-biz/SKILL.md returns ≥ 3
  • grep "messaging_product.*whatsapp" claude-ops/skills/ops-whatsapp-biz/SKILL.md — PASS
  • grep "message_templates" claude-ops/skills/ops-whatsapp-biz/SKILL.md returns ≥ 3
  • grep "cost estimate" claude-ops/skills/ops-whatsapp-biz/SKILL.md — PASS
  • grep "whatsapp-biz\|waba" claude-ops/skills/setup/SKILL.md — PASS
  • grep "Separate from wacli\|personal WhatsApp" claude-ops/skills/ops-whatsapp-biz/SKILL.md — PASS