productivity
WhatsApp Business CLI for AI Agents
Use the WhatsApp Business CLI from KosmoKrator to call WhatsApp Business tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.WhatsApp Business CLI Setup
WhatsApp Business can be configured headlessly with `kosmokrator integrations:configure whatsapp`.
# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash
# Configure and verify this integration.
kosmokrator integrations:configure whatsapp --set access_token="$WHATSAPP_ACCESS_TOKEN" --enable --read allow --write ask --json
kosmokrator integrations:doctor whatsapp --json
kosmokrator integrations:status --json Credentials
Authentication type: Bearer token bearer_token. Configure credentials once, then reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.
| Key | Env var | Type | Required | Label |
|---|---|---|---|---|
access_token | WHATSAPP_ACCESS_TOKEN | Secret secret | yes | Access Token |
phone_number_id | WHATSAPP_PHONE_NUMBER_ID | Text string | no | Phone Number ID |
whatsapp_business_account_id | WHATSAPP_WHATSAPP_BUSINESS_ACCOUNT_ID | Text string | no | WhatsApp Business Account ID |
base_url | WHATSAPP_BASE_URL | URL url | no | API Base URL |
Command Patterns
The generic command is stable across every integration. The provider shortcut is shorter for humans.
kosmo integrations:call whatsapp.whatsapp_send_message '{"to":"example_to","body":"example_body","preview_url":true}' --json kosmo integrations:whatsapp whatsapp_send_message '{"to":"example_to","body":"example_body","preview_url":true}' --json Discovery
These commands return structured output for coding agents that need to inspect capabilities before choosing a function.
kosmo integrations:docs whatsapp --json
kosmo integrations:docs whatsapp.whatsapp_send_message --json
kosmo integrations:schema whatsapp.whatsapp_send_message --json
kosmo integrations:search "WhatsApp Business" --json
kosmo integrations:list --json Automation Contexts
The same configured command surface works in these environments. The command does not change unless the host wrapper, credentials, or permissions change.
CLI Functions
Every function below can be called headlessly. Commands are highlighted, copyable, and scroll horizontally when payloads are long.
whatsapp.whatsapp_send_message
Send a text message to a WhatsApp recipient. Use this for replying within an existing 24-hour customer service window. For new conversations, use the send_template tool instead.
write - Parameters
- to, body, preview_url
kosmo integrations:call whatsapp.whatsapp_send_message '{"to":"example_to","body":"example_body","preview_url":true}' --json kosmo integrations:whatsapp whatsapp_send_message '{"to":"example_to","body":"example_body","preview_url":true}' --json whatsapp.whatsapp_send_template
Send a template-based WhatsApp message. Use this to initiate new conversations outside the 24-hour window. The template must be pre-approved in the WhatsApp Business Manager.
write - Parameters
- to, template_name, language, components
kosmo integrations:call whatsapp.whatsapp_send_template '{"to":"example_to","template_name":"example_template_name","language":"example_language","components":"example_components"}' --json kosmo integrations:whatsapp whatsapp_send_template '{"to":"example_to","template_name":"example_template_name","language":"example_language","components":"example_components"}' --json whatsapp.whatsapp_send_message_payload
Send any official WhatsApp Cloud API message payload to the configured phone number.
write - Parameters
- payload
kosmo integrations:call whatsapp.whatsapp_send_message_payload '{"payload":"example_payload"}' --json kosmo integrations:whatsapp whatsapp_send_message_payload '{"payload":"example_payload"}' --json whatsapp.whatsapp_mark_message_read
Mark an inbound WhatsApp message as read using its message ID.
write - Parameters
- message_id
kosmo integrations:call whatsapp.whatsapp_mark_message_read '{"message_id":"example_message_id"}' --json kosmo integrations:whatsapp whatsapp_mark_message_read '{"message_id":"example_message_id"}' --json whatsapp.whatsapp_get_message
Retrieve a specific WhatsApp message or Graph object by ID with optional fields.
read - Parameters
- message_id, fields
kosmo integrations:call whatsapp.whatsapp_get_message '{"message_id":"example_message_id","fields":"example_fields"}' --json kosmo integrations:whatsapp whatsapp_get_message '{"message_id":"example_message_id","fields":"example_fields"}' --json whatsapp.whatsapp_check_contacts
Validate one or more phone numbers through the WhatsApp Cloud API contacts endpoint.
read - Parameters
- contacts
kosmo integrations:call whatsapp.whatsapp_check_contacts '{"contacts":"example_contacts"}' --json kosmo integrations:whatsapp whatsapp_check_contacts '{"contacts":"example_contacts"}' --json whatsapp.whatsapp_list_contacts
Validate WhatsApp contacts for the configured business phone number. Legacy slug for check_contacts.
read - Parameters
- contacts
kosmo integrations:call whatsapp.whatsapp_list_contacts '{"contacts":"example_contacts"}' --json kosmo integrations:whatsapp whatsapp_list_contacts '{"contacts":"example_contacts"}' --json whatsapp.whatsapp_upload_media
Upload a local image, video, audio, sticker, or document file to WhatsApp media storage.
write - Parameters
- file_path, mime_type
kosmo integrations:call whatsapp.whatsapp_upload_media '{"file_path":"example_file_path","mime_type":"example_mime_type"}' --json kosmo integrations:whatsapp whatsapp_upload_media '{"file_path":"example_file_path","mime_type":"example_mime_type"}' --json whatsapp.whatsapp_get_media
Get WhatsApp media metadata and the temporary download URL for a media ID.
read - Parameters
- media_id
kosmo integrations:call whatsapp.whatsapp_get_media '{"media_id":"example_media_id"}' --json kosmo integrations:whatsapp whatsapp_get_media '{"media_id":"example_media_id"}' --json whatsapp.whatsapp_delete_media
Delete an uploaded WhatsApp media object by media ID.
write - Parameters
- media_id
kosmo integrations:call whatsapp.whatsapp_delete_media '{"media_id":"example_media_id"}' --json kosmo integrations:whatsapp whatsapp_delete_media '{"media_id":"example_media_id"}' --json whatsapp.whatsapp_list_templates
List approved WhatsApp message templates. Templates are required to initiate new conversations outside the 24-hour service window.
read - Parameters
- limit, after, status, name
kosmo integrations:call whatsapp.whatsapp_list_templates '{"limit":1,"after":"example_after","status":"example_status","name":"example_name"}' --json kosmo integrations:whatsapp whatsapp_list_templates '{"limit":1,"after":"example_after","status":"example_status","name":"example_name"}' --json whatsapp.whatsapp_get_template
Get a WhatsApp message template by Graph template ID.
read - Parameters
- template_id
kosmo integrations:call whatsapp.whatsapp_get_template '{"template_id":"example_template_id"}' --json kosmo integrations:whatsapp whatsapp_get_template '{"template_id":"example_template_id"}' --json whatsapp.whatsapp_create_template
Create a WhatsApp message template on the configured WhatsApp Business Account.
write - Parameters
- template
kosmo integrations:call whatsapp.whatsapp_create_template '{"template":"example_template"}' --json kosmo integrations:whatsapp whatsapp_create_template '{"template":"example_template"}' --json whatsapp.whatsapp_update_template
Update a WhatsApp message template by Graph template ID.
write - Parameters
- template_id, template
kosmo integrations:call whatsapp.whatsapp_update_template '{"template_id":"example_template_id","template":"example_template"}' --json kosmo integrations:whatsapp whatsapp_update_template '{"template_id":"example_template_id","template":"example_template"}' --json whatsapp.whatsapp_delete_template
Delete a WhatsApp message template by name and optional template ID.
write - Parameters
- name, template_id
kosmo integrations:call whatsapp.whatsapp_delete_template '{"name":"example_name","template_id":"example_template_id"}' --json kosmo integrations:whatsapp whatsapp_delete_template '{"name":"example_name","template_id":"example_template_id"}' --json whatsapp.whatsapp_get_phone_number
Get phone number metadata such as display number, verified name, quality rating, and throughput.
read - Parameters
- phone_number_id
kosmo integrations:call whatsapp.whatsapp_get_phone_number '{"phone_number_id":"example_phone_number_id"}' --json kosmo integrations:whatsapp whatsapp_get_phone_number '{"phone_number_id":"example_phone_number_id"}' --json whatsapp.whatsapp_list_phone_numbers
List phone numbers attached to the configured WhatsApp Business Account.
read - Parameters
- limit, after
kosmo integrations:call whatsapp.whatsapp_list_phone_numbers '{"limit":1,"after":"example_after"}' --json kosmo integrations:whatsapp whatsapp_list_phone_numbers '{"limit":1,"after":"example_after"}' --json whatsapp.whatsapp_request_verification_code
Request a WhatsApp phone-number verification code by SMS or voice.
write - Parameters
- code_method, language, phone_number_id
kosmo integrations:call whatsapp.whatsapp_request_verification_code '{"code_method":"example_code_method","language":"example_language","phone_number_id":"example_phone_number_id"}' --json kosmo integrations:whatsapp whatsapp_request_verification_code '{"code_method":"example_code_method","language":"example_language","phone_number_id":"example_phone_number_id"}' --json whatsapp.whatsapp_verify_code
Verify a WhatsApp phone-number registration code.
write - Parameters
- code, phone_number_id
kosmo integrations:call whatsapp.whatsapp_verify_code '{"code":"example_code","phone_number_id":"example_phone_number_id"}' --json kosmo integrations:whatsapp whatsapp_verify_code '{"code":"example_code","phone_number_id":"example_phone_number_id"}' --json whatsapp.whatsapp_register_phone_number
Register a WhatsApp phone number for Cloud API use with a two-step verification PIN.
write - Parameters
- pin, phone_number_id
kosmo integrations:call whatsapp.whatsapp_register_phone_number '{"pin":"example_pin","phone_number_id":"example_phone_number_id"}' --json kosmo integrations:whatsapp whatsapp_register_phone_number '{"pin":"example_pin","phone_number_id":"example_phone_number_id"}' --json whatsapp.whatsapp_deregister_phone_number
Deregister a WhatsApp phone number from Cloud API use.
write - Parameters
- phone_number_id
kosmo integrations:call whatsapp.whatsapp_deregister_phone_number '{"phone_number_id":"example_phone_number_id"}' --json kosmo integrations:whatsapp whatsapp_deregister_phone_number '{"phone_number_id":"example_phone_number_id"}' --json whatsapp.whatsapp_get_business_profile
Get the WhatsApp business profile for the configured phone number.
read - Parameters
- fields
kosmo integrations:call whatsapp.whatsapp_get_business_profile '{"fields":"example_fields"}' --json kosmo integrations:whatsapp whatsapp_get_business_profile '{"fields":"example_fields"}' --json whatsapp.whatsapp_update_business_profile
Update the WhatsApp business profile fields for the configured phone number.
write - Parameters
- profile
kosmo integrations:call whatsapp.whatsapp_update_business_profile '{"profile":"example_profile"}' --json kosmo integrations:whatsapp whatsapp_update_business_profile '{"profile":"example_profile"}' --json whatsapp.whatsapp_list_subscribed_apps
List apps subscribed to the configured WhatsApp Business Account webhook events.
read - Parameters
- none
kosmo integrations:call whatsapp.whatsapp_list_subscribed_apps '{}' --json kosmo integrations:whatsapp whatsapp_list_subscribed_apps '{}' --json whatsapp.whatsapp_subscribe_app
Subscribe the configured app to WhatsApp Business Account webhook events.
write - Parameters
- none
kosmo integrations:call whatsapp.whatsapp_subscribe_app '{}' --json kosmo integrations:whatsapp whatsapp_subscribe_app '{}' --json whatsapp.whatsapp_unsubscribe_app
Unsubscribe the configured app from WhatsApp Business Account webhook events.
write - Parameters
- none
kosmo integrations:call whatsapp.whatsapp_unsubscribe_app '{}' --json kosmo integrations:whatsapp whatsapp_unsubscribe_app '{}' --json whatsapp.whatsapp_get_current_user
Get the authenticated WhatsApp Business user info - name, email, and business ID. Useful for verifying which account is connected.
read - Parameters
- none
kosmo integrations:call whatsapp.whatsapp_get_current_user '{}' --json kosmo integrations:whatsapp whatsapp_get_current_user '{}' --json whatsapp.whatsapp_api_get
Call a safe relative Meta Graph API path with GET for WhatsApp endpoints not yet modeled as first-class tools.
read - Parameters
- path, params
kosmo integrations:call whatsapp.whatsapp_api_get '{"path":"example_path","params":"example_params"}' --json kosmo integrations:whatsapp whatsapp_api_get '{"path":"example_path","params":"example_params"}' --json whatsapp.whatsapp_api_post
Call a safe relative Meta Graph API path with POST for WhatsApp endpoints not yet modeled as first-class tools.
write - Parameters
- path, payload, params
kosmo integrations:call whatsapp.whatsapp_api_post '{"path":"example_path","payload":"example_payload","params":"example_params"}' --json kosmo integrations:whatsapp whatsapp_api_post '{"path":"example_path","payload":"example_payload","params":"example_params"}' --json whatsapp.whatsapp_api_delete
Call a safe relative Meta Graph API path with DELETE for WhatsApp endpoints not yet modeled as first-class tools.
write - Parameters
- path, params
kosmo integrations:call whatsapp.whatsapp_api_delete '{"path":"example_path","params":"example_params"}' --json kosmo integrations:whatsapp whatsapp_api_delete '{"path":"example_path","params":"example_params"}' --json Function Schemas
Use these parameter tables when building CLI payloads without calling integrations:schema first.
whatsapp.whatsapp_send_message 3 parameters
kosmo integrations:schema whatsapp.whatsapp_send_message --json | Parameter | Type | Required | Description |
|---|---|---|---|
to | string | yes | Recipient phone number in international format without + (e.g. "15551234567"). |
body | string | yes | Text content of the message (max 4096 characters). |
preview_url | boolean | no | Whether to render URLs as link previews in the message (default: false). |
whatsapp.whatsapp_send_template 4 parameters
kosmo integrations:schema whatsapp.whatsapp_send_template --json | Parameter | Type | Required | Description |
|---|---|---|---|
to | string | yes | Recipient phone number in international format without + (e.g. "15551234567"). |
template_name | string | yes | Name of the approved WhatsApp template (e.g. "hello_world"). |
language | string | no | Language code for the template (e.g. "en_US", "en"). Defaults to "en". |
components | array | no | Template components as an array of objects with type and parameters. Pass as a JSON string or array. |
whatsapp.whatsapp_send_message_payload 1 parameters
kosmo integrations:schema whatsapp.whatsapp_send_message_payload --json | Parameter | Type | Required | Description |
|---|---|---|---|
payload | object | yes | Cloud API message payload without messaging_product. |
whatsapp.whatsapp_mark_message_read 1 parameters
kosmo integrations:schema whatsapp.whatsapp_mark_message_read --json | Parameter | Type | Required | Description |
|---|---|---|---|
message_id | string | yes | Inbound WhatsApp message ID. |
whatsapp.whatsapp_get_message 2 parameters
kosmo integrations:schema whatsapp.whatsapp_get_message --json | Parameter | Type | Required | Description |
|---|---|---|---|
message_id | string | yes | The WhatsApp message ID or Graph object ID. |
fields | string | no | Optional comma-separated Graph fields to request. |
whatsapp.whatsapp_check_contacts 1 parameters
kosmo integrations:schema whatsapp.whatsapp_check_contacts --json | Parameter | Type | Required | Description |
|---|---|---|---|
contacts | array | yes | Phone numbers in international format without +. |
whatsapp.whatsapp_list_contacts 1 parameters
kosmo integrations:schema whatsapp.whatsapp_list_contacts --json | Parameter | Type | Required | Description |
|---|---|---|---|
contacts | array | yes | Phone numbers in international format without +. |
whatsapp.whatsapp_upload_media 2 parameters
kosmo integrations:schema whatsapp.whatsapp_upload_media --json | Parameter | Type | Required | Description |
|---|---|---|---|
file_path | string | yes | Readable local file path. |
mime_type | string | yes | MIME type such as image/jpeg or application/pdf. |
whatsapp.whatsapp_get_media 1 parameters
kosmo integrations:schema whatsapp.whatsapp_get_media --json | Parameter | Type | Required | Description |
|---|---|---|---|
media_id | string | yes | WhatsApp media ID. |
whatsapp.whatsapp_delete_media 1 parameters
kosmo integrations:schema whatsapp.whatsapp_delete_media --json | Parameter | Type | Required | Description |
|---|---|---|---|
media_id | string | yes | WhatsApp media ID. |
whatsapp.whatsapp_list_templates 4 parameters
kosmo integrations:schema whatsapp.whatsapp_list_templates --json | Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Maximum number of templates to return (default: 100). |
after | string | no | Cursor for pagination. |
status | string | no | Optional template status filter such as APPROVED, PENDING, or REJECTED. |
name | string | no | Optional template name filter. |
whatsapp.whatsapp_get_template 1 parameters
kosmo integrations:schema whatsapp.whatsapp_get_template --json | Parameter | Type | Required | Description |
|---|---|---|---|
template_id | string | yes | Message template Graph ID. |
whatsapp.whatsapp_create_template 1 parameters
kosmo integrations:schema whatsapp.whatsapp_create_template --json | Parameter | Type | Required | Description |
|---|---|---|---|
template | object | yes | Template creation payload with name, language, category, and components. |
whatsapp.whatsapp_update_template 2 parameters
kosmo integrations:schema whatsapp.whatsapp_update_template --json | Parameter | Type | Required | Description |
|---|---|---|---|
template_id | string | yes | Message template Graph ID. |
template | object | yes | Template update payload. |
whatsapp.whatsapp_delete_template 2 parameters
kosmo integrations:schema whatsapp.whatsapp_delete_template --json | Parameter | Type | Required | Description |
|---|---|---|---|
name | string | yes | Template name. |
template_id | string | no | Optional template ID for a specific language variant. |
whatsapp.whatsapp_get_phone_number 1 parameters
kosmo integrations:schema whatsapp.whatsapp_get_phone_number --json | Parameter | Type | Required | Description |
|---|---|---|---|
phone_number_id | string | no | Optional phone number ID. Defaults to the configured phone number. |
whatsapp.whatsapp_list_phone_numbers 2 parameters
kosmo integrations:schema whatsapp.whatsapp_list_phone_numbers --json | Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Maximum number of phone numbers to return. |
after | string | no | Pagination cursor. |
whatsapp.whatsapp_request_verification_code 3 parameters
kosmo integrations:schema whatsapp.whatsapp_request_verification_code --json | Parameter | Type | Required | Description |
|---|---|---|---|
code_method | string | yes | Delivery method. |
language | string | no | Language code for the verification message. Defaults to en. |
phone_number_id | string | no | Optional phone number ID. Defaults to configured phone number. |
whatsapp.whatsapp_verify_code 2 parameters
kosmo integrations:schema whatsapp.whatsapp_verify_code --json | Parameter | Type | Required | Description |
|---|---|---|---|
code | string | yes | Verification code from Meta. |
phone_number_id | string | no | Optional phone number ID. Defaults to configured phone number. |
whatsapp.whatsapp_register_phone_number 2 parameters
kosmo integrations:schema whatsapp.whatsapp_register_phone_number --json | Parameter | Type | Required | Description |
|---|---|---|---|
pin | string | yes | Two-step verification PIN. |
phone_number_id | string | no | Optional phone number ID. Defaults to configured phone number. |
whatsapp.whatsapp_deregister_phone_number 1 parameters
kosmo integrations:schema whatsapp.whatsapp_deregister_phone_number --json | Parameter | Type | Required | Description |
|---|---|---|---|
phone_number_id | string | no | Optional phone number ID. Defaults to configured phone number. |
whatsapp.whatsapp_get_business_profile 1 parameters
kosmo integrations:schema whatsapp.whatsapp_get_business_profile --json | Parameter | Type | Required | Description |
|---|---|---|---|
fields | string | no | Comma-separated business profile fields. |
whatsapp.whatsapp_update_business_profile 1 parameters
kosmo integrations:schema whatsapp.whatsapp_update_business_profile --json | Parameter | Type | Required | Description |
|---|---|---|---|
profile | object | yes | Business profile fields such as about, address, description, email, websites, vertical, and profile_picture_handle. |
whatsapp.whatsapp_list_subscribed_apps 0 parameters
kosmo integrations:schema whatsapp.whatsapp_list_subscribed_apps --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
whatsapp.whatsapp_subscribe_app 0 parameters
kosmo integrations:schema whatsapp.whatsapp_subscribe_app --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
whatsapp.whatsapp_unsubscribe_app 0 parameters
kosmo integrations:schema whatsapp.whatsapp_unsubscribe_app --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
whatsapp.whatsapp_get_current_user 0 parameters
kosmo integrations:schema whatsapp.whatsapp_get_current_user --json | Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
whatsapp.whatsapp_api_get 2 parameters
kosmo integrations:schema whatsapp.whatsapp_api_get --json | Parameter | Type | Required | Description |
|---|---|---|---|
path | string | yes | Relative Graph API path, such as /me or /{waba_id}/message_templates. |
params | object | no | Query parameters. |
whatsapp.whatsapp_api_post 3 parameters
kosmo integrations:schema whatsapp.whatsapp_api_post --json | Parameter | Type | Required | Description |
|---|---|---|---|
path | string | yes | Relative Graph API path. |
payload | object | no | JSON request body. |
params | object | no | Query parameters. |
whatsapp.whatsapp_api_delete 2 parameters
kosmo integrations:schema whatsapp.whatsapp_api_delete --json | Parameter | Type | Required | Description |
|---|---|---|---|
path | string | yes | Relative Graph API path. |
params | object | no | Query parameters. |
Permissions
Headless calls still follow the integration read/write permission policy. Configure read/write defaults with
integrations:configure. Add --force only for trusted automation that should bypass that policy.