KosmoKrator

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, configure, and verify
# 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.

KeyEnv varTypeRequiredLabel
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.

Generic CLI call
kosmo integrations:call whatsapp.whatsapp_send_message '{"to":"example_to","body":"example_body","preview_url":true}' --json
Provider shortcut
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.

Discovery commands
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 write
Parameters
to, body, preview_url
Generic call
kosmo integrations:call whatsapp.whatsapp_send_message '{"to":"example_to","body":"example_body","preview_url":true}' --json
Shortcut
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 write
Parameters
to, template_name, language, components
Generic call
kosmo integrations:call whatsapp.whatsapp_send_template '{"to":"example_to","template_name":"example_template_name","language":"example_language","components":"example_components"}' --json
Shortcut
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 write
Parameters
payload
Generic call
kosmo integrations:call whatsapp.whatsapp_send_message_payload '{"payload":"example_payload"}' --json
Shortcut
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 write
Parameters
message_id
Generic call
kosmo integrations:call whatsapp.whatsapp_mark_message_read '{"message_id":"example_message_id"}' --json
Shortcut
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 read
Parameters
message_id, fields
Generic call
kosmo integrations:call whatsapp.whatsapp_get_message '{"message_id":"example_message_id","fields":"example_fields"}' --json
Shortcut
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 read
Parameters
contacts
Generic call
kosmo integrations:call whatsapp.whatsapp_check_contacts '{"contacts":"example_contacts"}' --json
Shortcut
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 read
Parameters
contacts
Generic call
kosmo integrations:call whatsapp.whatsapp_list_contacts '{"contacts":"example_contacts"}' --json
Shortcut
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 write
Parameters
file_path, mime_type
Generic call
kosmo integrations:call whatsapp.whatsapp_upload_media '{"file_path":"example_file_path","mime_type":"example_mime_type"}' --json
Shortcut
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 read
Parameters
media_id
Generic call
kosmo integrations:call whatsapp.whatsapp_get_media '{"media_id":"example_media_id"}' --json
Shortcut
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 write
Parameters
media_id
Generic call
kosmo integrations:call whatsapp.whatsapp_delete_media '{"media_id":"example_media_id"}' --json
Shortcut
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 read
Parameters
limit, after, status, name
Generic call
kosmo integrations:call whatsapp.whatsapp_list_templates '{"limit":1,"after":"example_after","status":"example_status","name":"example_name"}' --json
Shortcut
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 read
Parameters
template_id
Generic call
kosmo integrations:call whatsapp.whatsapp_get_template '{"template_id":"example_template_id"}' --json
Shortcut
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 write
Parameters
template
Generic call
kosmo integrations:call whatsapp.whatsapp_create_template '{"template":"example_template"}' --json
Shortcut
kosmo integrations:whatsapp whatsapp_create_template '{"template":"example_template"}' --json

whatsapp.whatsapp_update_template

Update a WhatsApp message template by Graph template ID.

Write write
Parameters
template_id, template
Generic call
kosmo integrations:call whatsapp.whatsapp_update_template '{"template_id":"example_template_id","template":"example_template"}' --json
Shortcut
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 write
Parameters
name, template_id
Generic call
kosmo integrations:call whatsapp.whatsapp_delete_template '{"name":"example_name","template_id":"example_template_id"}' --json
Shortcut
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 read
Parameters
phone_number_id
Generic call
kosmo integrations:call whatsapp.whatsapp_get_phone_number '{"phone_number_id":"example_phone_number_id"}' --json
Shortcut
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 read
Parameters
limit, after
Generic call
kosmo integrations:call whatsapp.whatsapp_list_phone_numbers '{"limit":1,"after":"example_after"}' --json
Shortcut
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 write
Parameters
code_method, language, phone_number_id
Generic call
kosmo integrations:call whatsapp.whatsapp_request_verification_code '{"code_method":"example_code_method","language":"example_language","phone_number_id":"example_phone_number_id"}' --json
Shortcut
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 write
Parameters
code, phone_number_id
Generic call
kosmo integrations:call whatsapp.whatsapp_verify_code '{"code":"example_code","phone_number_id":"example_phone_number_id"}' --json
Shortcut
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 write
Parameters
pin, phone_number_id
Generic call
kosmo integrations:call whatsapp.whatsapp_register_phone_number '{"pin":"example_pin","phone_number_id":"example_phone_number_id"}' --json
Shortcut
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 write
Parameters
phone_number_id
Generic call
kosmo integrations:call whatsapp.whatsapp_deregister_phone_number '{"phone_number_id":"example_phone_number_id"}' --json
Shortcut
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 read
Parameters
fields
Generic call
kosmo integrations:call whatsapp.whatsapp_get_business_profile '{"fields":"example_fields"}' --json
Shortcut
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 write
Parameters
profile
Generic call
kosmo integrations:call whatsapp.whatsapp_update_business_profile '{"profile":"example_profile"}' --json
Shortcut
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 read
Parameters
none
Generic call
kosmo integrations:call whatsapp.whatsapp_list_subscribed_apps '{}' --json
Shortcut
kosmo integrations:whatsapp whatsapp_list_subscribed_apps '{}' --json

whatsapp.whatsapp_subscribe_app

Subscribe the configured app to WhatsApp Business Account webhook events.

Write write
Parameters
none
Generic call
kosmo integrations:call whatsapp.whatsapp_subscribe_app '{}' --json
Shortcut
kosmo integrations:whatsapp whatsapp_subscribe_app '{}' --json

whatsapp.whatsapp_unsubscribe_app

Unsubscribe the configured app from WhatsApp Business Account webhook events.

Write write
Parameters
none
Generic call
kosmo integrations:call whatsapp.whatsapp_unsubscribe_app '{}' --json
Shortcut
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 read
Parameters
none
Generic call
kosmo integrations:call whatsapp.whatsapp_get_current_user '{}' --json
Shortcut
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 read
Parameters
path, params
Generic call
kosmo integrations:call whatsapp.whatsapp_api_get '{"path":"example_path","params":"example_params"}' --json
Shortcut
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 write
Parameters
path, payload, params
Generic call
kosmo integrations:call whatsapp.whatsapp_api_post '{"path":"example_path","payload":"example_payload","params":"example_params"}' --json
Shortcut
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 write
Parameters
path, params
Generic call
kosmo integrations:call whatsapp.whatsapp_api_delete '{"path":"example_path","params":"example_params"}' --json
Shortcut
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
Schema command
kosmo integrations:schema whatsapp.whatsapp_send_message --json
ParameterTypeRequiredDescription
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
Schema command
kosmo integrations:schema whatsapp.whatsapp_send_template --json
ParameterTypeRequiredDescription
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
Schema command
kosmo integrations:schema whatsapp.whatsapp_send_message_payload --json
ParameterTypeRequiredDescription
payload object yes Cloud API message payload without messaging_product.
whatsapp.whatsapp_mark_message_read 1 parameters
Schema command
kosmo integrations:schema whatsapp.whatsapp_mark_message_read --json
ParameterTypeRequiredDescription
message_id string yes Inbound WhatsApp message ID.
whatsapp.whatsapp_get_message 2 parameters
Schema command
kosmo integrations:schema whatsapp.whatsapp_get_message --json
ParameterTypeRequiredDescription
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
Schema command
kosmo integrations:schema whatsapp.whatsapp_check_contacts --json
ParameterTypeRequiredDescription
contacts array yes Phone numbers in international format without +.
whatsapp.whatsapp_list_contacts 1 parameters
Schema command
kosmo integrations:schema whatsapp.whatsapp_list_contacts --json
ParameterTypeRequiredDescription
contacts array yes Phone numbers in international format without +.
whatsapp.whatsapp_upload_media 2 parameters
Schema command
kosmo integrations:schema whatsapp.whatsapp_upload_media --json
ParameterTypeRequiredDescription
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
Schema command
kosmo integrations:schema whatsapp.whatsapp_get_media --json
ParameterTypeRequiredDescription
media_id string yes WhatsApp media ID.
whatsapp.whatsapp_delete_media 1 parameters
Schema command
kosmo integrations:schema whatsapp.whatsapp_delete_media --json
ParameterTypeRequiredDescription
media_id string yes WhatsApp media ID.
whatsapp.whatsapp_list_templates 4 parameters
Schema command
kosmo integrations:schema whatsapp.whatsapp_list_templates --json
ParameterTypeRequiredDescription
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
Schema command
kosmo integrations:schema whatsapp.whatsapp_get_template --json
ParameterTypeRequiredDescription
template_id string yes Message template Graph ID.
whatsapp.whatsapp_create_template 1 parameters
Schema command
kosmo integrations:schema whatsapp.whatsapp_create_template --json
ParameterTypeRequiredDescription
template object yes Template creation payload with name, language, category, and components.
whatsapp.whatsapp_update_template 2 parameters
Schema command
kosmo integrations:schema whatsapp.whatsapp_update_template --json
ParameterTypeRequiredDescription
template_id string yes Message template Graph ID.
template object yes Template update payload.
whatsapp.whatsapp_delete_template 2 parameters
Schema command
kosmo integrations:schema whatsapp.whatsapp_delete_template --json
ParameterTypeRequiredDescription
name string yes Template name.
template_id string no Optional template ID for a specific language variant.
whatsapp.whatsapp_get_phone_number 1 parameters
Schema command
kosmo integrations:schema whatsapp.whatsapp_get_phone_number --json
ParameterTypeRequiredDescription
phone_number_id string no Optional phone number ID. Defaults to the configured phone number.
whatsapp.whatsapp_list_phone_numbers 2 parameters
Schema command
kosmo integrations:schema whatsapp.whatsapp_list_phone_numbers --json
ParameterTypeRequiredDescription
limit integer no Maximum number of phone numbers to return.
after string no Pagination cursor.
whatsapp.whatsapp_request_verification_code 3 parameters
Schema command
kosmo integrations:schema whatsapp.whatsapp_request_verification_code --json
ParameterTypeRequiredDescription
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
Schema command
kosmo integrations:schema whatsapp.whatsapp_verify_code --json
ParameterTypeRequiredDescription
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
Schema command
kosmo integrations:schema whatsapp.whatsapp_register_phone_number --json
ParameterTypeRequiredDescription
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
Schema command
kosmo integrations:schema whatsapp.whatsapp_deregister_phone_number --json
ParameterTypeRequiredDescription
phone_number_id string no Optional phone number ID. Defaults to configured phone number.
whatsapp.whatsapp_get_business_profile 1 parameters
Schema command
kosmo integrations:schema whatsapp.whatsapp_get_business_profile --json
ParameterTypeRequiredDescription
fields string no Comma-separated business profile fields.
whatsapp.whatsapp_update_business_profile 1 parameters
Schema command
kosmo integrations:schema whatsapp.whatsapp_update_business_profile --json
ParameterTypeRequiredDescription
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
Schema command
kosmo integrations:schema whatsapp.whatsapp_list_subscribed_apps --json
ParameterTypeRequiredDescription
No parameters.
whatsapp.whatsapp_subscribe_app 0 parameters
Schema command
kosmo integrations:schema whatsapp.whatsapp_subscribe_app --json
ParameterTypeRequiredDescription
No parameters.
whatsapp.whatsapp_unsubscribe_app 0 parameters
Schema command
kosmo integrations:schema whatsapp.whatsapp_unsubscribe_app --json
ParameterTypeRequiredDescription
No parameters.
whatsapp.whatsapp_get_current_user 0 parameters
Schema command
kosmo integrations:schema whatsapp.whatsapp_get_current_user --json
ParameterTypeRequiredDescription
No parameters.
whatsapp.whatsapp_api_get 2 parameters
Schema command
kosmo integrations:schema whatsapp.whatsapp_api_get --json
ParameterTypeRequiredDescription
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
Schema command
kosmo integrations:schema whatsapp.whatsapp_api_post --json
ParameterTypeRequiredDescription
path string yes Relative Graph API path.
payload object no JSON request body.
params object no Query parameters.
whatsapp.whatsapp_api_delete 2 parameters
Schema command
kosmo integrations:schema whatsapp.whatsapp_api_delete --json
ParameterTypeRequiredDescription
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.