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 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.
| Key | Env var | Type | Required | Label |
|---|---|---|---|---|
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.
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 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.
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 - Parameters
- to, from, body, media_url, status_callback
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 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 - Parameters
- message_sid
kosmo integrations:call twilio.twilio_get_message '{"message_sid":"example_message_sid"}' --json 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 - Parameters
- to, from, date_sent, limit, page_size
kosmo integrations:call twilio.twilio_list_messages '{"to":"example_to","from":"example_from","date_sent":"example_date_sent","limit":1,"page_size":1}' --json 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 - Parameters
- to, from, url, twiml, status_callback
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 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 - Parameters
- call_sid
kosmo integrations:call twilio.twilio_get_call '{"call_sid":"example_call_sid"}' --json 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 - Parameters
- to, from, status, limit, page_size
kosmo integrations:call twilio.twilio_list_calls '{"to":"example_to","from":"example_from","status":"example_status","limit":1,"page_size":1}' --json 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 - Parameters
- limit
kosmo integrations:call twilio.twilio_list_phone_numbers '{"limit":1}' --json 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 - Parameters
- phone_sid
kosmo integrations:call twilio.twilio_get_phone_number '{"phone_sid":"example_phone_sid"}' --json 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 - Parameters
- phone_number, fields
kosmo integrations:call twilio.twilio_lookup_phone '{"phone_number":"example_phone_number","fields":"example_fields"}' --json 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 - Parameters
- usage_category, trigger_value, callback_url, recurring
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 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 - Parameters
- category, start_date, end_date, limit
kosmo integrations:call twilio.twilio_list_usage_records '{"category":"example_category","start_date":"example_start_date","end_date":"example_end_date","limit":1}' --json 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 - Parameters
- to, from, body, media_url
kosmo integrations:call twilio.twilio_send_whatsapp '{"to":"example_to","from":"example_from","body":"example_body","media_url":"example_media_url"}' --json 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 - Parameters
- sid
kosmo integrations:call twilio.twilio_get_account '{"sid":"example_sid"}' --json 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 - Parameters
- call_sid, date_created, limit
kosmo integrations:call twilio.twilio_list_recordings '{"call_sid":"example_call_sid","date_created":"example_date_created","limit":1}' --json 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 - Parameters
- recording_sid
kosmo integrations:call twilio.twilio_delete_recording '{"recording_sid":"example_recording_sid"}' --json 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
kosmo integrations:schema twilio.twilio_send_sms --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema twilio.twilio_get_message --json | Parameter | Type | Required | Description |
|---|---|---|---|
message_sid | string | yes | Message SID (e.g., "SMxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"). |
twilio.twilio_list_messages 5 parameters
kosmo integrations:schema twilio.twilio_list_messages --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema twilio.twilio_make_call --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema twilio.twilio_get_call --json | Parameter | Type | Required | Description |
|---|---|---|---|
call_sid | string | yes | Call SID (e.g., "CAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"). |
twilio.twilio_list_calls 5 parameters
kosmo integrations:schema twilio.twilio_list_calls --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema twilio.twilio_list_phone_numbers --json | Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | no | Maximum number of phone numbers to return. |
twilio.twilio_get_phone_number 1 parameters
kosmo integrations:schema twilio.twilio_get_phone_number --json | Parameter | Type | Required | Description |
|---|---|---|---|
phone_sid | string | yes | Phone number SID (e.g., "PNxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"). |
twilio.twilio_lookup_phone 2 parameters
kosmo integrations:schema twilio.twilio_lookup_phone --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema twilio.twilio_create_usage_trigger --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema twilio.twilio_list_usage_records --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema twilio.twilio_send_whatsapp --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema twilio.twilio_get_account --json | Parameter | Type | Required | Description |
|---|---|---|---|
sid | string | no | Account SID to look up, or omit for the current account. |
twilio.twilio_list_recordings 3 parameters
kosmo integrations:schema twilio.twilio_list_recordings --json | Parameter | Type | Required | Description |
|---|---|---|---|
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
kosmo integrations:schema twilio.twilio_delete_recording --json | Parameter | Type | Required | Description |
|---|---|---|---|
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.