Agent-skills automate-whatsapp
Build WhatsApp automations with Kapso workflows: configure WhatsApp triggers, edit workflow graphs, manage executions, deploy functions, and use databases/integrations for state. Use when automating WhatsApp conversations and event handling.
git clone https://github.com/gokapso/agent-skills
T=$(mktemp -d) && git clone --depth=1 https://github.com/gokapso/agent-skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/automate-whatsapp" ~/.claude/skills/gokapso-agent-skills-automate-whatsapp && rm -rf "$T"
skills/automate-whatsapp/SKILL.mdAutomate WhatsApp
When to use
Use this skill to build and run WhatsApp automations: workflow CRUD, graph edits, triggers, executions, function management, app integrations, and D1 database operations.
Setup
Preferred path:
- Kapso CLI installed and authenticated (
)kapso login - Use the CLI for project/number discovery before wiring triggers or automations
Fallback path: Env vars:
(host only, noKAPSO_API_BASE_URL
)/platform/v1KAPSO_API_KEY
How to
Discover phone numbers first
Preferred path:
- Check project state:
kapso status - List connected numbers:
kapso whatsapp numbers list --output json - Resolve a display number when needed:
kapso whatsapp numbers resolve --phone-number "<display-number>" --output json
Fallback path:
- List number configs for triggers:
node scripts/list-whatsapp-phone-numbers.js
Edit a workflow graph
- Fetch graph:
(note thenode scripts/get-graph.js <workflow_id>
)lock_version - Edit the JSON (see graph rules below)
- Validate:
node scripts/validate-graph.js --definition-file <path> - Update:
node scripts/update-graph.js <workflow_id> --expected-lock-version <n> --definition-file <path> - Re-fetch to confirm
For small edits, use
edit-graph.js with --old-file and --new-file instead.
If you get a lock_version conflict: re-fetch, re-apply changes, retry with new lock_version.
Manage triggers
- List:
node scripts/list-triggers.js <workflow_id> - Create:
node scripts/create-trigger.js <workflow_id> --trigger-type <type> --phone-number-id <id> - Toggle:
node scripts/update-trigger.js --trigger-id <id> --active true|false - Delete:
node scripts/delete-trigger.js --trigger-id <id>
For inbound_message triggers, prefer
kapso whatsapp numbers resolve --phone-number "<display-number>" --output json to get the exact phone_number_id. Fall back to node scripts/list-whatsapp-phone-numbers.js when the CLI is unavailable.
Debug executions
- List:
node scripts/list-executions.js <workflow_id> - Inspect:
node scripts/get-execution.js <execution-id> - Get value:
node scripts/get-context-value.js <execution-id> --variable-path vars.foo - Events:
node scripts/list-execution-events.js <execution-id>
Create and deploy a function
- Write code with handler signature (see function rules below)
- Create:
node scripts/create-function.js --name <name> --code-file <path> [--public-endpoint true] - Deploy:
node scripts/deploy-function.js --function-id <id> - Verify:
node scripts/get-function.js --function-id <id>
Use
--public-endpoint true when the function should be callable without X-API-Key via the Kapso-hosted invoke URL. This is only supported for Cloudflare functions.
New functions default to invoke_response_mode=passthrough, which returns the function body directly on successful invoke. Legacy wrapped functions can be migrated later with update-function.js.
Set up agent node with app integrations
- Find model:
node scripts/list-provider-models.js - Find account:
(usenode scripts/list-accounts.js --app-slug <slug>
)pipedream_account_id - Find action:
(action_id = key)node scripts/search-actions.js --query <word> --app-slug <slug> - Create integration:
node scripts/create-integration.js --action-id <id> --app-slug <slug> --account-id <id> --configured-props <json> - Add tools to agent node via
flow_agent_app_integration_tools
Database CRUD
- List tables:
node scripts/list-tables.js - Query:
node scripts/query-rows.js --table <name> --filters <json> - Create/update/delete with row scripts
Graph rules
- Exactly one start node with
=idstart - Never change existing node IDs
- Use
for new node IDs{node_type}_{timestamp_ms} - Non-decide nodes have 0 or 1 outgoing
edgenext - Decide edge labels must match
conditions[].label - Edge keys are
/source
/target
(notlabel
/from
)to
For full schema details, see
references/graph-contract.md.
Function rules
async function handler(request, env) { // Parse input const body = await request.json(); // Use env.KV and env.DB as needed return new Response(JSON.stringify({ result: "ok" })); }
- Do NOT use
,export
, or arrow functionsexport default - Return a
objectResponse
Execution context
Always use this structure:
- user-defined variablesvars
- system variablessystem
- channel datacontext
- request metadatametadata
Scripts
Workflows
| Script | Purpose |
|---|---|
| List workflows (metadata only) |
| Get workflow metadata |
| Create a workflow |
| Update workflow settings |
Graph
| Script | Purpose |
|---|---|
| Get workflow graph + lock_version |
| Patch graph via string replacement |
| Replace entire graph |
| Validate graph structure locally |
Triggers
| Script | Purpose |
|---|---|
| List triggers for a workflow |
| Create a trigger |
| Enable/disable a trigger |
| Delete a trigger |
| List phone numbers for trigger setup |
Executions
| Script | Purpose |
|---|---|
| List executions |
| Get execution details |
| Read value from execution context |
| Force execution state |
| Resume waiting execution |
| List execution events |
Functions
| Script | Purpose |
|---|---|
| List project functions |
| Get function details + code |
| Create a function, optionally with a public invoke endpoint |
| Update function code, public endpoint setting, or migrate a legacy wrapped function to passthrough |
| Deploy function to runtime |
| Invoke function with payload |
| List function invocations |
App integrations
| Script | Purpose |
|---|---|
| Search integration apps |
| Search actions (action_id = key) |
| Get action JSON schema |
| List connected accounts |
| Create OAuth connect link |
| Resolve remote_options for a prop |
| Reload dynamic props |
| List saved integrations |
| Create an integration |
| Update an integration |
| Delete an integration |
Databases
| Script | Purpose |
|---|---|
| List D1 tables |
| Get table schema + sample rows |
| Query rows with filters |
| Create a row |
| Update rows |
| Upsert a row |
| Delete rows |
OpenAPI
| Script | Purpose |
|---|---|
| Explore OpenAPI (search/op/schema/where) |
Install deps (once):
npm i
Examples:
node scripts/openapi-explore.mjs --spec workflows search "variables" node scripts/openapi-explore.mjs --spec workflows op getWorkflowVariables node scripts/openapi-explore.mjs --spec platform op queryDatabaseRows
Notes
- Prefer file paths over inline JSON (
,--definition-file
)--code-file
is the same asaction_id
fromkeysearch-actions
uses--account-id
frompipedream_account_idlist-accounts- Variable CRUD (
,variables-set.js
) is blocked - Platform API doesn't support itvariables-delete.js - Raw SQL execution is not supported via Platform API
References
Read before editing:
- references/graph-contract.md - Graph schema, computed vs editable fields, lock_version
- references/node-types.md - Node types and config shapes
- references/workflow-overview.md - Execution flow and states
Other references:
- references/execution-context.md - Context structure and variable substitution
- references/triggers.md - Trigger types and setup
- references/app-integrations.md - App integration and variable_definitions
- references/functions-reference.md - Function management
- references/functions-payloads.md - Payload shapes for functions
- references/databases-reference.md - Database operations
Assets
| File | Description |
|---|---|
| Minimal linear workflow |
| Minimal branching workflow |
| Minimal agent workflow |
| Customer support intake |
| Interactive buttons + decide (function) |
| Interactive buttons + decide (AI) |
| API trigger + template + agent |
| Function for button routing |
| Agent node with app integrations |
Related skills
- Onboarding, webhooks, messaging, templates, flowsintegrate-whatsapp
- Debugging, logs, health checksobserve-whatsapp
<!-- FILEMAP:END -->[automate-whatsapp file map]|root: . |.:{package.json,SKILL.md} |assets:{agent-app-integration-example.json,databases-example.json,function-decide-route-interactive-buttons.json,functions-example.json,workflow-agent-simple.json,workflow-api-template-wait-agent.json,workflow-customer-support-intake-agent.json,workflow-decision.json,workflow-interactive-buttons-decide-ai.json,workflow-interactive-buttons-decide-function.json,workflow-linear.json} |references:{app-integrations.md,databases-reference.md,execution-context.md,function-contracts.md,functions-payloads.md,functions-reference.md,graph-contract.md,node-types.md,triggers.md,workflow-overview.md,workflow-reference.md} |scripts:{configure-prop.js,create-connect-token.js,create-function.js,create-integration.js,create-row.js,create-trigger.js,create-workflow.js,delete-integration.js,delete-row.js,delete-trigger.js,deploy-function.js,edit-graph.js,get-action-schema.js,get-context-value.js,get-execution-event.js,get-execution.js,get-function.js,get-graph.js,get-table.js,get-workflow.js,invoke-function.js,list-accounts.js,list-apps.js,list-execution-events.js,list-executions.js,list-function-invocations.js,list-functions.js,list-integrations.js,list-provider-models.js,list-tables.js,list-triggers.js,list-whatsapp-phone-numbers.js,list-workflows.js,openapi-explore.mjs,query-rows.js,reload-props.js,resume-execution.js,search-actions.js,update-execution-status.js,update-function.js,update-graph.js,update-integration.js,update-row.js,update-trigger.js,update-workflow-settings.js,upsert-row.js,validate-graph.js,variables-delete.js,variables-list.js,variables-set.js} |scripts/lib/databases:{args.js,filters.js,kapso-api.js} |scripts/lib/functions:{args.js,kapso-api.js} |scripts/lib/workflows:{args.js,kapso-api.js,result.js}