KosmoKrator

productivity

Twilio CLI for AI Agents

Use the Twilio CLI from KosmoKrator to call Twilio tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

Twilio CLI Setup

Twilio can be configured headlessly with `kosmokrator integrations:configure twilio`.

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 twilio --set account_sid="$TWILIO_ACCOUNT_SID" --set auth_token="$TWILIO_AUTH_TOKEN" --enable --read allow --write ask --json
kosmokrator integrations:doctor twilio --json
kosmokrator integrations:status --json

Credentials

Authentication type: API token api_token. Configure credentials once, then reuse the same stored profile from scripts, coding CLIs, Lua, and MCP.

KeyEnv varTypeRequiredLabel
account_sid TWILIO_ACCOUNT_SID Text text yes Account SID
auth_token TWILIO_AUTH_TOKEN Secret secret yes Auth Token

Command Patterns

The generic command is stable across every integration. The provider shortcut is shorter for humans.

Generic CLI call
kosmo integrations:call twilio.twilio_send_sms '{"to":"example_to","from":"example_from","body":"example_body","media_url":"example_media_url","status_callback":"example_status_callback"}' --json
Provider shortcut
kosmo integrations:twilio twilio_send_sms '{"to":"example_to","from":"example_from","body":"example_body","media_url":"example_media_url","status_callback":"example_status_callback"}' --json

Discovery

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

Discovery commands
kosmo integrations:docs twilio --json
kosmo integrations:docs twilio.twilio_send_sms --json
kosmo integrations:schema twilio.twilio_send_sms --json
kosmo integrations:search "Twilio" --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.

twilio.twilio_send_sms

Send an SMS or MMS message via Twilio. Provide "to" and "from" phone numbers in E.164 format (e.g., "+15551234567"). Optionally include media_url for MMS and status_callback for delivery tracking.

Write write
Parameters
to, from, body, media_url, status_callback
Generic call
kosmo integrations:call twilio.twilio_send_sms '{"to":"example_to","from":"example_from","body":"example_body","media_url":"example_media_url","status_callback":"example_status_callback"}' --json
Shortcut
kosmo integrations:twilio twilio_send_sms '{"to":"example_to","from":"example_from","body":"example_body","media_url":"example_media_url","status_callback":"example_status_callback"}' --json

twilio.twilio_get_message

Retrieve a Twilio message by its SID. Returns the full message details including status, body, timestamps, and pricing.

Read read
Parameters
message_sid
Generic call
kosmo integrations:call twilio.twilio_get_message '{"message_sid":"example_message_sid"}' --json
Shortcut
kosmo integrations:twilio twilio_get_message '{"message_sid":"example_message_sid"}' --json

twilio.twilio_list_messages

List Twilio messages with optional filtering. Filter by To, From, DateSent. Use PageSize to control pagination (default 50, max 1000).

Read read
Parameters
to, from, date_sent, limit, page_size
Generic call
kosmo integrations:call twilio.twilio_list_messages '{"to":"example_to","from":"example_from","date_sent":"example_date_sent","limit":1,"page_size":1}' --json
Shortcut
kosmo integrations:twilio twilio_list_messages '{"to":"example_to","from":"example_from","date_sent":"example_date_sent","limit":1,"page_size":1}' --json

twilio.twilio_make_call

Make an outbound voice call via Twilio. Provide a "url" that returns TwiML, or inline "twiml" to control the call. Optionally provide a status_callback URL for call progress events.

Write write
Parameters
to, from, url, twiml, status_callback
Generic call
kosmo integrations:call twilio.twilio_make_call '{"to":"example_to","from":"example_from","url":"example_url","twiml":"example_twiml","status_callback":"example_status_callback"}' --json
Shortcut
kosmo integrations:twilio twilio_make_call '{"to":"example_to","from":"example_from","url":"example_url","twiml":"example_twiml","status_callback":"example_status_callback"}' --json

twilio.twilio_get_call

Retrieve a Twilio call by its SID. Returns the full call details including status, duration, timestamps, and pricing.

Read read
Parameters
call_sid
Generic call
kosmo integrations:call twilio.twilio_get_call '{"call_sid":"example_call_sid"}' --json
Shortcut
kosmo integrations:twilio twilio_get_call '{"call_sid":"example_call_sid"}' --json

twilio.twilio_list_calls

List Twilio calls with optional filtering. Filter by To, From, Status. Use PageSize to control pagination (default 50, max 1000).

Read read
Parameters
to, from, status, limit, page_size
Generic call
kosmo integrations:call twilio.twilio_list_calls '{"to":"example_to","from":"example_from","status":"example_status","limit":1,"page_size":1}' --json
Shortcut
kosmo integrations:twilio twilio_list_calls '{"to":"example_to","from":"example_from","status":"example_status","limit":1,"page_size":1}' --json

twilio.twilio_list_phone_numbers

List incoming phone numbers on the Twilio account. Returns all phone numbers associated with the account, including capabilities.

Read read
Parameters
limit
Generic call
kosmo integrations:call twilio.twilio_list_phone_numbers '{"limit":1}' --json
Shortcut
kosmo integrations:twilio twilio_list_phone_numbers '{"limit":1}' --json

twilio.twilio_get_phone_number

Retrieve a Twilio incoming phone number by its SID. Returns phone number details including capabilities and configuration.

Read read
Parameters
phone_sid
Generic call
kosmo integrations:call twilio.twilio_get_phone_number '{"phone_sid":"example_phone_sid"}' --json
Shortcut
kosmo integrations:twilio twilio_get_phone_number '{"phone_sid":"example_phone_sid"}' --json

twilio.twilio_lookup_phone

Lookup phone number details using the Twilio Lookup API v2. Provide a phone number in E.164 format. Optionally request additional fields like "caller_name", "line_type_intelligence", "sim_swap", or "call_forwarding".

Read read
Parameters
phone_number, fields
Generic call
kosmo integrations:call twilio.twilio_lookup_phone '{"phone_number":"example_phone_number","fields":"example_fields"}' --json
Shortcut
kosmo integrations:twilio twilio_lookup_phone '{"phone_number":"example_phone_number","fields":"example_fields"}' --json

twilio.twilio_create_usage_trigger

Create a usage trigger on the Twilio account. Twilio will notify the callback URL when usage of the specified category exceeds the trigger value. Supports recurring triggers (daily, monthly, yearly) or one-time triggers.

Write write
Parameters
usage_category, trigger_value, callback_url, recurring
Generic call
kosmo integrations:call twilio.twilio_create_usage_trigger '{"usage_category":"example_usage_category","trigger_value":"example_trigger_value","callback_url":"example_callback_url","recurring":"example_recurring"}' --json
Shortcut
kosmo integrations:twilio twilio_create_usage_trigger '{"usage_category":"example_usage_category","trigger_value":"example_trigger_value","callback_url":"example_callback_url","recurring":"example_recurring"}' --json

twilio.twilio_list_usage_records

List Twilio usage records with optional filtering. Filter by category and date range. Returns usage counts and pricing per category.

Read read
Parameters
category, start_date, end_date, limit
Generic call
kosmo integrations:call twilio.twilio_list_usage_records '{"category":"example_category","start_date":"example_start_date","end_date":"example_end_date","limit":1}' --json
Shortcut
kosmo integrations:twilio twilio_list_usage_records '{"category":"example_category","start_date":"example_start_date","end_date":"example_end_date","limit":1}' --json

twilio.twilio_send_whatsapp

Send a WhatsApp message via Twilio. Provide "to" and "from" phone numbers in E.164 format — they will automatically be prefixed with "whatsapp:". Supports text and media messages.

Write write
Parameters
to, from, body, media_url
Generic call
kosmo integrations:call twilio.twilio_send_whatsapp '{"to":"example_to","from":"example_from","body":"example_body","media_url":"example_media_url"}' --json
Shortcut
kosmo integrations:twilio twilio_send_whatsapp '{"to":"example_to","from":"example_from","body":"example_body","media_url":"example_media_url"}' --json

twilio.twilio_get_account

Retrieve Twilio account details. Optionally provide an account SID to look up a specific subaccount, or omit to retrieve the current account.

Read read
Parameters
sid
Generic call
kosmo integrations:call twilio.twilio_get_account '{"sid":"example_sid"}' --json
Shortcut
kosmo integrations:twilio twilio_get_account '{"sid":"example_sid"}' --json

twilio.twilio_list_recordings

List Twilio call recordings with optional filtering. Filter by call SID, date created, or limit the number of results returned.

Read read
Parameters
call_sid, date_created, limit
Generic call
kosmo integrations:call twilio.twilio_list_recordings '{"call_sid":"example_call_sid","date_created":"example_date_created","limit":1}' --json
Shortcut
kosmo integrations:twilio twilio_list_recordings '{"call_sid":"example_call_sid","date_created":"example_date_created","limit":1}' --json

twilio.twilio_delete_recording

Delete a Twilio recording by its SID. Permanently removes the recording and all associated media. This action cannot be undone.

Write write
Parameters
recording_sid
Generic call
kosmo integrations:call twilio.twilio_delete_recording '{"recording_sid":"example_recording_sid"}' --json
Shortcut
kosmo integrations:twilio twilio_delete_recording '{"recording_sid":"example_recording_sid"}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

twilio.twilio_send_sms 5 parameters
Schema command
kosmo integrations:schema twilio.twilio_send_sms --json
ParameterTypeRequiredDescription
to string yes Destination phone number in E.164 format.
from string yes Twilio phone number to send from in E.164 format.
body string yes Text body of the message (max 1600 characters).
media_url string no URL of media to include (for MMS).
status_callback string no URL Twilio will call with status updates.
twilio.twilio_get_message 1 parameters
Schema command
kosmo integrations:schema twilio.twilio_get_message --json
ParameterTypeRequiredDescription
message_sid string yes Message SID (e.g., "SMxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx").
twilio.twilio_list_messages 5 parameters
Schema command
kosmo integrations:schema twilio.twilio_list_messages --json
ParameterTypeRequiredDescription
to string no Filter by destination phone number in E.164 format.
from string no Filter by originating phone number in E.164 format.
date_sent string no Filter by date sent (YYYY-MM-DD format).
limit integer no Maximum number of messages to return.
page_size integer no Number of results per page (default 50, max 1000).
twilio.twilio_make_call 5 parameters
Schema command
kosmo integrations:schema twilio.twilio_make_call --json
ParameterTypeRequiredDescription
to string yes Destination phone number in E.164 format.
from string yes Twilio phone number to call from in E.164 format.
url string no URL that returns TwiML instructions for the call.
twiml string no Inline TwiML to execute when the call connects.
status_callback string no URL Twilio will call with status updates.
twilio.twilio_get_call 1 parameters
Schema command
kosmo integrations:schema twilio.twilio_get_call --json
ParameterTypeRequiredDescription
call_sid string yes Call SID (e.g., "CAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx").
twilio.twilio_list_calls 5 parameters
Schema command
kosmo integrations:schema twilio.twilio_list_calls --json
ParameterTypeRequiredDescription
to string no Filter by destination phone number in E.164 format.
from string no Filter by originating phone number in E.164 format.
status string no Filter by call status (queued, ringing, in-progress, canceled, completed, failed, busy, no-answer).
limit integer no Maximum number of calls to return.
page_size integer no Number of results per page (default 50, max 1000).
twilio.twilio_list_phone_numbers 1 parameters
Schema command
kosmo integrations:schema twilio.twilio_list_phone_numbers --json
ParameterTypeRequiredDescription
limit integer no Maximum number of phone numbers to return.
twilio.twilio_get_phone_number 1 parameters
Schema command
kosmo integrations:schema twilio.twilio_get_phone_number --json
ParameterTypeRequiredDescription
phone_sid string yes Phone number SID (e.g., "PNxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx").
twilio.twilio_lookup_phone 2 parameters
Schema command
kosmo integrations:schema twilio.twilio_lookup_phone --json
ParameterTypeRequiredDescription
phone_number string yes Phone number in E.164 format (e.g., "+15551234567").
fields string no Comma-separated list of additional fields to request (e.g., "line_type_intelligence,caller_name").
twilio.twilio_create_usage_trigger 4 parameters
Schema command
kosmo integrations:schema twilio.twilio_create_usage_trigger --json
ParameterTypeRequiredDescription
usage_category string yes Usage category to monitor (e.g., "calls", "sms", "phonenumbers", "totalprice").
trigger_value string yes Usage value that triggers the callback (e.g., "100.00").
callback_url string yes URL Twilio will call when the trigger fires.
recurring string no Recurrence interval: "daily", "monthly", "yearly", or omit for one-time.
twilio.twilio_list_usage_records 4 parameters
Schema command
kosmo integrations:schema twilio.twilio_list_usage_records --json
ParameterTypeRequiredDescription
category string no Filter by usage category (e.g., "calls", "sms", "phonenumbers", "totalprice").
start_date string no Start date for usage records (YYYY-MM-DD format).
end_date string no End date for usage records (YYYY-MM-DD format).
limit integer no Maximum number of records to return.
twilio.twilio_send_whatsapp 4 parameters
Schema command
kosmo integrations:schema twilio.twilio_send_whatsapp --json
ParameterTypeRequiredDescription
to string yes Destination phone number in E.164 format (e.g., "+15551234567").
from string yes Twilio WhatsApp-enabled phone number in E.164 format.
body string yes Text body of the WhatsApp message.
media_url string no URL of media to include (image, audio, video, or document).
twilio.twilio_get_account 1 parameters
Schema command
kosmo integrations:schema twilio.twilio_get_account --json
ParameterTypeRequiredDescription
sid string no Account SID to look up, or omit for the current account.
twilio.twilio_list_recordings 3 parameters
Schema command
kosmo integrations:schema twilio.twilio_list_recordings --json
ParameterTypeRequiredDescription
call_sid string no Filter by call SID to get recordings for a specific call.
date_created string no Filter by date created (YYYY-MM-DD format).
limit integer no Maximum number of recordings to return.
twilio.twilio_delete_recording 1 parameters
Schema command
kosmo integrations:schema twilio.twilio_delete_recording --json
ParameterTypeRequiredDescription
recording_sid string yes Recording SID (e.g., "RExxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx").

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.