Integrate Whatsapp
Connect WhatsApp to your product with Kapso: onboard customers with setup links, detect connections, receive events via webhooks, and send messages/templates/media. Also manage WhatsApp Flows (create/update/publish, data endpoints, encryption). Use when integrating WhatsApp end-to-end.
- Skill ID
- gokapso/agent-skills/integrate-whatsapp
- Publisher
- gokapso
- Repository
- agent-skills
- Installs
- 0
- Files
- 78
- Synced
- Sep 23, 2026
Open any RiverX project, open the Skills panel in the chat, and search for this identifier. The files are fetched from the source repository at install time.
gokapso/agent-skills/integrate-whatsappInstalls these files- SKILL.md
- assets/dynamic-flow.json
- assets/sample-flow.json
- assets/send-interactive-buttons.json
- assets/send-interactive-catalog-message.json
- assets/send-interactive-cta-url.json
- assets/send-interactive-list.json
- assets/send-interactive-location-request.json
- assets/send-template-order-status-update.json
- assets/template-authentication-otp.json
- assets/template-marketing-media-header.json
- assets/template-utility-named.json
- assets/template-utility-order-status-update.json
- assets/webhooks-example.json
- package.json
- references/detecting-whatsapp-connection.md
- references/getting-started.md
- references/platform-api-reference.md
- references/setup-links.md
- references/templates-reference.md
- references/webhooks-event-types.md
- references/webhooks-overview.md
- references/webhooks-reference.md
- references/whatsapp-api-reference.md
- references/whatsapp-cloud-api-js.md
- references/whatsapp-flows-spec.md
- scripts/create-flow.js
- scripts/create-function.js
- scripts/create-template.mjs
- scripts/create.js
- scripts/delete-flow.js
- scripts/delete.js
- scripts/deploy-data-endpoint.js
- scripts/deploy-function.js
- scripts/get-data-endpoint.js
- scripts/get-encryption-status.js
- scripts/get-flow.js
- scripts/get-function.js
- scripts/get.js
- scripts/lib/args.mjs
- scripts/lib/cli.js
- scripts/lib/env.js
- scripts/lib/env.mjs
- scripts/lib/http.js
- scripts/lib/output.js
- scripts/lib/output.mjs
- scripts/lib/request.mjs
- scripts/lib/run.js
- scripts/lib/webhooks/args.js
- scripts/lib/webhooks/kapso-api.js
- scripts/lib/webhooks/webhook.js
- scripts/lib/whatsapp-flow.js
- scripts/list-connected-numbers.mjs
- scripts/list-flow-responses.js
- scripts/list-flows.js
- scripts/list-function-invocations.js
- scripts/list-function-logs.js
- scripts/list-platform-phone-numbers.mjs
- scripts/list-templates.mjs
- scripts/list.js
- scripts/openapi-explore.mjs
- scripts/publish-flow.js
- scripts/read-flow-json.js
- scripts/register-data-endpoint.js
- scripts/send-interactive.mjs
- scripts/send-template.mjs
- scripts/send-test-flow.js
- scripts/set-data-endpoint.js
- scripts/setup-encryption.js
- scripts/submit-template.mjs
- scripts/template-status.mjs
- scripts/test.js
- scripts/update-flow-json.js
- scripts/update-function.js
- scripts/update-template.mjs
- scripts/update.js
- scripts/upload-media.mjs
- scripts/upload-template-header-handle.mjs
What this skill tells the agent
Integrate WhatsApp
Setup
Preferred path:
- Kapso CLI installed and authenticated (
kapso login) - Use
kapso statusto confirm project access before onboarding or messaging
Fallback path: Env vars:
KAPSO_API_BASE_URL(host only, no/platform/v1)KAPSO_API_KEYMETA_GRAPH_VERSION(optional, defaultv24.0)
Auth header (direct API calls):
X-API-Key: <api_key>Install deps (once):
npm iConnect WhatsApp (setup links)
Preferred onboarding path (CLI):
- Start onboarding:
kapso setup - If setup is blocked, resolve context with:
kapso projects listkapso projects use <project-id>kapso customers listkapso customers new --name "<customer-name>" --external-id <external-id>kapso setup --customer <customer-id>
- Complete the hosted onboarding URL
- Confirm connected numbers:
kapso whatsapp numbers list --output json - Resolve the exact number you want to operate:
kapso whatsapp numbers resolve --phone-number "<display-number>" --output json
Fallback onboarding flow (direct API):
- Create customer:
POST /platform/v1/customers - Generate setup link:
POST /platform/v1/customers/:id/setup_links - Customer completes embedded signup
- Use
phone_number_idto send messages and configure webhooks
Detect connection:
- Project webhook
whatsapp.phone_number.created(recommended) - Success redirect URL query params (use for frontend UX)
Recommended Kapso setup-link defaults:
{
"setup_link": {
"allowed_connection_types": ["dedicated"],
"provision_phone_number": true,
"phone_number_country_isos": ["US"]
}
}Notes:
kapso setupandkapso whatsapp numbers newuse dedicated plus provisioning by default.- Keep
phone_number_country_isos,phone_number_area_code,language, and redirect URLs as optional overrides.
- Platform API base:
/platform/v1 - Meta proxy base:
/meta/whatsapp/v24.0(messaging, templates, media) - Use
phone_number_idas the primary WhatsApp identifier
Receive events (webhooks)
Use webhooks to receive:
- Project events (connection lifecycle, workflow events)
- Phone-number events (messages, conversations, delivery status)
Scope rules:
- Project webhooks: only project-level events (connection lifecycle, workflow events)
- Phone-number webhooks: only WhatsApp message + conversation events for that
phone_number_id - WhatsApp message/conversation events (
whatsapp.message.*,whatsapp.conversation.*) are phone-number only
Create a webhook:
- Project-level:
node scripts/create.js --scope project --url <https://...> --events <csv> - Phone-number:
node scripts/create.js --phone-number-id <id> --url <https://...> --events <csv>
Common flags for create/update:
--url <https://...>- webhook destination--events <csv|json-array>- event types (Kapso webhooks)--kind <kapso|meta>- Kapso (event-based) vs raw Meta forwarding--payload-version <v1|v2>- payload format (v2recommended)--buffer-enabled <true|false>- enable buffering forwhatsapp.message.received--buffer-window-seconds <n>- 1-60 seconds--max-buffer-size <n>- 1-100--active <true|false>- enable/disable
Test delivery:
node scripts/test.js --webhook-id <id>Always verify signatures. See:
references/webhooks-overview.mdreferences/webhooks-reference.md
Send and read messages
Discover IDs first
Two Meta IDs are needed for different operations:
| ID | Used for | How to discover |
|---|---|---|
business_account_id (WABA) | Template CRUD | kapso whatsapp numbers resolve --phone-number "<display-number>" --output json or node scripts/list-platform-phone-numbers.mjs |
phone_number_id | Sending messages, media upload | kapso whatsapp numbers resolve --phone-number "<display-number>" --output json or node scripts/list-platform-phone-numbers.mjs |
Operate with the CLI first
Common commands:
kapso whatsapp numbers list --output json
kapso whatsapp numbers resolve --phone-number "<display-number>" --output json
kapso whatsapp messages send --phone-number-id <PHONE_NUMBER_ID> --to <wa-id> --text "Hello from Kapso"
kapso whatsapp messages list --phone-number-id <PHONE_NUMBER_ID> --limit 50 --output json
kapso whatsapp messages get <MESSAGE_ID> --phone-number-id <PHONE_NUMBER_ID> --output json
kapso whatsapp conversations list --phone-number-id <PHONE_NUMBER_ID> --output json
kapso whatsapp templates list --phone-number-id <PHONE_NUMBER_ID> --output json
kapso whatsapp templates get <TEMPLATE_ID> --phone-number-id <PHONE_NUMBER_ID> --output jsonSDK setup
Install:
npm install @kapso/whatsapp-cloud-apiCreate client:
import { WhatsAppClient } from "@kapso/whatsapp-cloud-api";
const client = new WhatsAppClient({
baseUrl: "https://api.kapso.ai/meta/whatsapp",
kapsoApiKey: process.env.KAPSO_API_KEY!
});Send a text message
Via SDK:
await client.messages.sendText({
phoneNumberId: "<PHONE_NUMBER_ID>",
to: "+15551234567",
body: "Hello from Kapso"
});Send a template message
- Discover IDs:
node scripts/list-platform-phone-numbers.mjs - Draft template payload from
assets/template-utility-order-status-update.json - Create:
node scripts/create-template.mjs --business-account-id <WABA_ID> --file <payload.json> - Check status:
node scripts/template-status.mjs --business-account-id <WABA_ID> --name <name> - Send:
node scripts/send-template.mjs --phone-number-id <ID> --file <send-payload.json>
Send an interactive message
Interactive messages require an active 24-hour session window. For outbound notifications outside the window, use templates.
- Discover
phone_number_id - Pick payload from
assets/send-interactive-*.json - Send:
node scripts/send-interactive.mjs --phone-number-id <ID> --file <payload.json>
For a contact information request, use interactive.type: "request_contact_info" with action.name: "request_contact_info". Include body, but omit header and footer.
Read inbox data
Preferred path:
- CLI:
kapso whatsapp messages ...,kapso whatsapp conversations ...,kapso whatsapp templates ...
Fallback path:
- Proxy:
GET /{phone_number_id}/messages,GET /{phone_number_id}/conversations - SDK:
client.messages.query(),client.messages.get(),client.conversations.list(),client.conversations.get(),client.templates.get()
Embed the inbox
Use Platform API inbox embeds when the user wants to place Kapso's inbox inside their own app.
Create:
POST /platform/v1/inbox_embeds- Envelope:
inbox_embed - Public scopes:
project,customer,phone_number scope_idis blank forproject, a customer UUID forcustomer, and WhatsAppphone_number_idforphone_numberlanguagecontrols the embedded inbox UI language; supported values areenandes- Create returns
tokenandembed_urlonce. Storeembed_url; list/get/update omit secrets.
Example:
{
"inbox_embed": {
"name": "Support inbox",
"scope_type": "phone_number",
"scope_id": "1234567890",
"allowed_origins": ["https://app.example.com"],
"default_mode": "system",
"language": "es"
}
}Manage:
GET /platform/v1/inbox_embedsGET /platform/v1/inbox_embeds/:idPATCH /platform/v1/inbox_embeds/:idDELETE /platform/v1/inbox_embeds/:id(revokes)
Template rules
Creation:
- Use
parameter_format: "NAMED"with{{param_name}}(preferred over positional) - Include examples when using variables in HEADER/BODY
- Use
language(notlanguage_code) - Don't interleave QUICK_REPLY with URL/PHONE_NUMBER buttons
- URL button variables must be at the end of the URL and use positional
{{1}} - For a
REQUEST_CONTACT_INFObutton, omittext; WhatsApp supplies the label
Send-time:
- For NAMED templates, include
parameter_namein header/body params
More from gokapso
Use this skill in a project
Open any RiverX project, search the Skills panel for gokapso/agent-skills/integrate-whatsapp, and install it in one click.
