KosmoKrator

communication

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.

15 functions 10 read 5 write API token auth

Twilio CLI Setup

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

# 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 use the same stored profile from scripts, coding CLIs, Lua code mode, and the MCP gateway.

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

Call Twilio Headlessly

Use the generic call form when another coding CLI or script needs a stable universal interface.

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

Use the provider shortcut form for shorter human-facing commands.

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

Agent Discovery Commands

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

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

All CLI Functions

Every function below can be called headlessly. The generic form is stable across all integrations; the provider shortcut is shorter but specific to Twilio.

twilio.twilio_send_sms

Write write

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.

Parameters
to, from, body, media_url, status_callback

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

twilio.twilio_get_message

Read read

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

Parameters
message_sid

Generic CLI call

kosmo integrations:call twilio.twilio_get_message '{"message_sid":"example_message_sid"}' --json

Provider shortcut

kosmo integrations:twilio twilio_get_message '{"message_sid":"example_message_sid"}' --json

twilio.twilio_list_messages

Read read

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

Parameters
to, from, date_sent, limit, page_size

Generic CLI 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

Provider 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

Write write

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.

Parameters
to, from, url, twiml, status_callback

Generic CLI 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

Provider 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

Read read

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

Parameters
call_sid

Generic CLI call

kosmo integrations:call twilio.twilio_get_call '{"call_sid":"example_call_sid"}' --json

Provider shortcut

kosmo integrations:twilio twilio_get_call '{"call_sid":"example_call_sid"}' --json

twilio.twilio_list_calls

Read read

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

Parameters
to, from, status, limit, page_size

Generic CLI call

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

Provider 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

Read read

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

Parameters
limit

Generic CLI call

kosmo integrations:call twilio.twilio_list_phone_numbers '{"limit":1}' --json

Provider shortcut

kosmo integrations:twilio twilio_list_phone_numbers '{"limit":1}' --json

twilio.twilio_get_phone_number

Read read

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

Parameters
phone_sid

Generic CLI call

kosmo integrations:call twilio.twilio_get_phone_number '{"phone_sid":"example_phone_sid"}' --json

Provider shortcut

kosmo integrations:twilio twilio_get_phone_number '{"phone_sid":"example_phone_sid"}' --json

twilio.twilio_lookup_phone

Read read

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".

Parameters
phone_number, fields

Generic CLI call

kosmo integrations:call twilio.twilio_lookup_phone '{"phone_number":"example_phone_number","fields":"example_fields"}' --json

Provider shortcut

kosmo integrations:twilio twilio_lookup_phone '{"phone_number":"example_phone_number","fields":"example_fields"}' --json

twilio.twilio_create_usage_trigger

Write write

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.

Parameters
usage_category, trigger_value, callback_url, recurring

Generic CLI 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

Provider 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

Read read

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

Parameters
category, start_date, end_date, limit

Generic CLI 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

Provider 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

Write write

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.

Parameters
to, from, body, media_url

Generic CLI call

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

Provider 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

Read read

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

Parameters
sid

Generic CLI call

kosmo integrations:call twilio.twilio_get_account '{"sid":"example_sid"}' --json

Provider shortcut

kosmo integrations:twilio twilio_get_account '{"sid":"example_sid"}' --json

twilio.twilio_list_recordings

Read read

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

Parameters
call_sid, date_created, limit

Generic CLI call

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

Provider shortcut

kosmo integrations:twilio twilio_list_recordings '{"call_sid":"example_call_sid","date_created":"example_date_created","limit":1}' --json

twilio.twilio_delete_recording

Write write

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

Parameters
recording_sid

Generic CLI call

kosmo integrations:call twilio.twilio_delete_recording '{"recording_sid":"example_recording_sid"}' --json

Provider 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

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.

Operation
Write write
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

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

Operation
Read read
Schema command
kosmo integrations:schema twilio.twilio_get_message --json
ParameterTypeRequiredDescription
message_sid string yes Message SID (e.g., "SMxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx").

twilio.twilio_list_messages

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

Operation
Read read
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

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.

Operation
Write write
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

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

Operation
Read read
Schema command
kosmo integrations:schema twilio.twilio_get_call --json
ParameterTypeRequiredDescription
call_sid string yes Call SID (e.g., "CAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx").

twilio.twilio_list_calls

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

Operation
Read read
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

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

Operation
Read read
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

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

Operation
Read read
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

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".

Operation
Read read
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

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.

Operation
Write write
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

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

Operation
Read read
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

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.

Operation
Write write
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

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

Operation
Read read
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

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

Operation
Read read
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

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

Operation
Write write
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.