home / skills / agentiveau / myagentive / twilio-phone

twilio-phone skill

/.claude/skills/twilio-phone

This skill lets you make natural AI voice calls and send SMS via Twilio from your terminal, simplifying automated communication.

npx playbooks add skill agentiveau/myagentive --skill twilio-phone

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
3.9 KB
---
name: twilio-phone
description: Make phone calls with natural AI voices (ElevenLabs) and send SMS using Twilio CLI. Use this skill when the user wants to make a phone call, send a text message, or use AI-generated voice for calls. Requires Twilio CLI authenticated and ElevenLabs API key.
---

# Twilio Phone Skill

Make phone calls with natural AI-generated voices (ElevenLabs) and send SMS using the official Twilio CLI.

## Quick Start - AI Voice Call

To make a call with a natural ElevenLabs voice, run the script:

```bash
./.claude/skills/twilio-phone/scripts/voice_call.py \
  --to "+61XXXXXXXXXX" \
  --message "Your message here"
```

## Available Phone Numbers

| Number | Region | Use For |
|--------|--------|---------|
| +61 3 4827 9516 | Australia | Australian calls/SMS |
| +1 978 878 5597 | USA | US calls/SMS |

## ElevenLabs Voices

| Voice ID | Name | Accent |
|----------|------|--------|
| IKne3meq5aSn9XLyUdCD | Charlie | Australian |
| JBFqnCBsd6RMkjVDRZzb | George | British |
| Xb7hH8MSUJpSbSDYk0k2 | Alice | British |
| EXAVITQu4vr4xnSDxMaL | Sarah | American |
| CwhRBWXzGAHq8TQ4Fs17 | Roger | American |

**Default:** Charlie (Australian) with `eleven_v3` model

## Manual Process (Step by Step)

### 1. Generate audio with ElevenLabs

```bash
curl -X POST "https://api.elevenlabs.io/v1/text-to-speech/IKne3meq5aSn9XLyUdCD?output_format=mp3_44100_128" \
  -H "xi-api-key: $ELEVENLABS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Your message here",
    "model_id": "eleven_v3",
    "voice_settings": {
      "stability": 0.5,
      "similarity_boost": 0.75
    }
  }' \
  --output /tmp/call_audio.mp3
```

### 2. Upload audio to public URL

```bash
curl -s -X POST -F "file=@/tmp/call_audio.mp3" "https://tmpfiles.org/api/v1/upload"
# Returns: {"data":{"url":"http://tmpfiles.org/XXXXXX/call_audio.mp3"}}
# Convert to direct URL: https://tmpfiles.org/dl/XXXXXX/call_audio.mp3
```

### 3. Make call with Twilio

```bash
twilio api:core:calls:create \
  --from "+61348279516" \
  --to "+61XXXXXXXXXX" \
  --twiml "<Response><Play>https://tmpfiles.org/dl/XXXXXX/call_audio.mp3</Play></Response>"
```

## Basic Twilio TTS Call (No ElevenLabs)

```bash
twilio api:core:calls:create \
  --from "+61348279516" \
  --to "+61XXXXXXXXXX" \
  --twiml "<Response><Say voice=\"alice\" language=\"en-AU\">Your message here.</Say></Response>"
```

## Sending SMS

```bash
twilio api:core:messages:create \
  --from "+61348279516" \
  --to "+61XXXXXXXXXX" \
  --body "Your message here"
```

## TwiML Elements

### Play - Play audio file
```xml
<Response><Play>https://example.com/audio.mp3</Play></Response>
```

### Say - Text to speech (Twilio built-in)
```xml
<Response><Say voice="alice" language="en-AU">Text to speak</Say></Response>
```

### Pause - Add silence
```xml
<Pause length="2"/>
```

### Gather - Collect DTMF input
```xml
<Gather numDigits="1" action="https://example.com/handle-key">
  <Say>Press 1 for sales, 2 for support.</Say>
</Gather>
```

## Call Options

| Option | Description |
|--------|-------------|
| `--timeout 30` | Ring for 30 seconds before giving up |
| `--record` | Record the call |
| `--machine-detection Enable` | Detect answering machines |
| `--send-digits "W1234#"` | Dial extension after connecting |

## Check Status

```bash
# List recent calls
twilio api:core:calls:list --limit 10

# Get specific call details
twilio api:core:calls:fetch --sid CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

# List recent SMS
twilio api:core:messages:list --limit 10
```

## Environment Variables

Required in `.env`:
```
ELEVENLABS_API_KEY=sk_xxxxx
```

Twilio CLI must be authenticated first. Run `twilio login` to configure.

## Important Notes

1. **Phone format**: Use E.164 format (+61 for Australia, +1 for US)
2. **Australian mobiles**: +614XXXXXXXX (drop leading 0)
3. **Audio hosting**: tmpfiles.org URLs expire after some time
4. **ElevenLabs model**: `eleven_v3` is the most natural sounding
5. **Default voice**: Charlie (Australian accent)

Overview

This skill lets you place phone calls using Twilio CLI and send SMS, with the option to use natural AI voices generated by ElevenLabs. It combines ElevenLabs text-to-speech for high-quality audio and Twilio for call/SMS delivery, requiring a logged-in Twilio CLI and an ElevenLabs API key. Use E.164 numbers and host generated audio at a public URL before calling.

How this skill works

The skill converts text to speech via ElevenLabs, saves an MP3, and uploads it to a public file host. Twilio CLI is then used to create a call that plays the hosted audio using TwiML <Play>, or to send SMS using Twilio messaging APIs. There’s a fallback to Twilio’s built-in TTS via <Say> if you don’t use ElevenLabs.

When to use it

  • Deliver personalized voice notifications with a natural-sounding AI voice
  • Send SMS alerts or confirmations from scripts or automation
  • Make automated appointment reminders or outbound campaigns
  • Test IVR flows that require pre-recorded audio
  • Use built-in Twilio TTS when an external voice provider is not available

Best practices

  • Always use E.164 phone formatting (+countrycode) to avoid delivery issues
  • Host generated audio on a reliable public URL; temporary hosts may expire
  • Keep voice messages concise to reduce file size and call costs
  • Secure your ElevenLabs API key in environment variables (ELEVENLABS_API_KEY) and authenticate Twilio CLI with twilio login
  • Test with a small set of numbers before broad distribution to confirm audio playback and call options

Example use cases

  • Appointment reminder calls using an Australian or American ElevenLabs voice
  • Automated support callbacks that play a prerecorded troubleshooting script
  • Sending SMS order confirmations or one-time codes via Twilio CLI
  • Rapidly prototype IVR prompts by uploading ElevenLabs audio and using Twilio <Gather> for input

FAQ

What credentials are required?

You must authenticate Twilio CLI (twilio login) and set ELEVENLABS_API_KEY in your environment.

Can I use Twilio’s TTS instead of ElevenLabs?

Yes — use TwiML <Say> to leverage Twilio’s built-in voices when ElevenLabs is not needed.

How do I ensure the audio plays on the call?

Generate an MP3 with ElevenLabs, upload to a public URL, then reference it inside <Play> in the TwiML used for the call.