Prank calling people with Twilio

A simple guide on how you can prank call your friends and colleagues with Twilio.

Prank calling people with Twilio

Confessions of a prankster.

One of my favorite pranks is fake calling people with Twilio, especially when I'm in the same room as them. Fake calling goes like this:

First I pick a target. The only thing I need is his/her phone number and my Twilio account.

Then, I pick the scenario I want to call them with. A scenario is an XML file with a set of instructions of what Twilio should do. An example could be:

<?xml version="1.0" encoding="UTF-8" ?>
    <Pause length="2"/>
    <Pause length="2"/>
    <Pause length="4"/>
    <Pause length="5"/>
    <Pause length="3"/>
    <Pause length="3"/>
    <Pause length="2"/>
    <Pause length="15"/>

In this scenario we tell Twilio to:

  1. Pause 2 seconds (because the other party picks up the phone, they'll probably introduce themselves first, which takes 2 seconds on average)
  2. Play an MP3 file
  3. Pause another 2 seconds for the other person to reply
  4. etc..

This is far from perfect for obvious reasons, but that's all we have.

I have around five scenarios to choose from. Different scenarios for different...needs.


When I picked the right scenario, I make a simple API call to Twilio or I use the Twilio API explorer to make the call. An example API call (with curl) would be:

curl ' Account SID/Calls.json' -X POST \

// the number I want to call
--data-urlencode 'To=+32498112233' \ 

// the number I bought in Twilio
--data-urlencode 'From=+32498445566' \ 

// URL of the XML file with the scenario I want to use
--data-urlencode 'Url=' \ 

// let's record the call!
--data-urlencode 'Record=true' \ 

-u AccountSID:AuthToken

When we make this API call, Twilio will hopefully give us a 2xx response in return with the RecordingSID. This is the unique ID of the recording of the call. As soon as the call is finished, the recording will be available for us to download.

curl '' -u AccountSID:AuthToken

This will return a JSON with links to a .WAV and .MP3 file for us to download.

You can then share this MP3 with your friends or colleagues in Slack and laugh all together about the fact that Dave from accounting thought he was really talking to Jean-Pierre van Rossem on the phone.